https://issues.dlang.org/show_bug.cgi?id=13683
Issue ID: 13683
Summary: More precise error message for wrong lambda
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
This is wrong code:
class Foo {}
void main() {
import std.algorithm: all;
Foo[] data;
assert(data.all!(f => f != null));
}
DMD 2.067alpha gives:
test.d(5,16): Error: template std.algorithm.all cannot deduce function from
argument types !((f) => f != null)(Foo[]), candidates are:
..\dmd2\src\phobos\std\algorithm.d(12251,1): std.algorithm.all(alias
pred = "a")
The correct code needs "!is" instead of "!=":
assert(data.all!(f => f !is null));
The error message should tell me more precisely what's the problem.
--