[Issue 9626] More precise error message in some cases when failed template constraint

2022-02-25 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9626

RazvanN  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||razvan.nitu1...@gmail.com
 Resolution|--- |FIXED

--- Comment #4 from RazvanN  ---
This has been fixed. Currently, for the bug report I get:

test.d(5): Error: none of the overloads of template
`std.algorithm.sorting.sort` are callable using argument types `!()(DList!int)`
../phobos/std/algorithm/sorting.d(1925):Candidate is: `sort(alias less
= "a < b", SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)`
  with `less = "a < b",
   ss = SwapStrategy.unstable,
   Range = DList!int`
  must satisfy one of the following constraints:
`   hasSwappableElements!Range
   hasAssignableElements!Range
   ss != SwapStrategy.unstable`

--


[Issue 9626] More precise error message in some cases when failed template constraint

2017-09-05 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9626

anonymous4  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=11729

--


[Issue 9626] More precise error message in some cases when failed template constraint

2016-04-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9626

--- Comment #3 from Sobirari Muhomori  ---
Even better error message would be "Error: template instance f1!1 does not
match template declaration f1(int n)(int val) if (n == 0), because template
constraint is not satisfied".

--


[Issue 9626] More precise error message in some cases when failed template constraint

2016-04-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9626

--- Comment #2 from Sobirari Muhomori  ---
void f(int n, T)(T val)if(n==0){}
void f1(int n)(int val)if(n==0){}
void g()
{
f!1(1);
f1!1(1);
}

The second instatiation gives good error message: "Error: template instance
f1!1 does not match template declaration f1(int n)(int val) if (n == 0)".

The first instatiation gives less helpful error message: "Error: template f
cannot deduce function from argument types !(1)(int), candidates are:...", but
it doesn't look like there's problem with deduction, should report no match.

See https://forum.dlang.org/post/gvzgecxrhdxrqchek...@forum.dlang.org

--


[Issue 9626] More precise error message in some cases when failed template constraint

2013-03-04 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9626



--- Comment #1 from bearophile_h...@eml.cc 2013-03-04 15:01:50 PST ---
An example of the problems this enhancement request should help solve. A
question from deed in D.learn:

http://forum.dlang.org/thread/djynnhlbfdxyurxvx...@forum.dlang.org


 Why randomAccessRange.array() before calling sort?
 The std.algorithm.sort doc says: Sorts a random-access range ...
 
 
 import std.algorithm, std.array;
 
 long[] source = [2, 0, 1];
 
 auto mapped = source.map!(a * 10);
 assert (isRandomAccessRange!(typeof(mapped))); // Passes. Implies possibility
// to to use 
 std.algorithm.sort?
 
 auto mappedThenSorted = mapped.sort(); // Error
 auto mappedThenSorted = mapped.array.sort();   // Works (and 
 used in examples)
 
 
 What am I missing in the documentation?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---