[Issue 13683] New: More precise error message for wrong lambda
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Nov 4 02:53:56 PST 2014
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: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
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.
--
More information about the Digitalmars-d-bugs
mailing list