February 01, 2023 [Issue 23663] New: Better error message for template with missing function | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23663 Issue ID: 23663 Summary: Better error message for template with missing function Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: grimmaple95@gmail.com Consider code below: ``` import std; void main() { auto a = [1, 2, 3]; a.each!(x => callback(x)); void callback(int a) { writeln(a); } } ``` The error message is completely bogus. It should just say that it can't find "callback". Current error message: ``` onlineapp.d(7): Error: none of the overloads of template `onlineapp.main.each!((x) => callback(x)).each` are callable using argument types `!()(int[])` /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(908): Candidates are: `each(Range)(Range r)` with `Range = int[]` must satisfy one of the following constraints: ` isRangeIterable!Range __traits(compiles, typeof(r.front).length)` /dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/iteration.d(969): `each(Iterable)(auto ref Iterable r)` with `Iterable = int[]` must satisfy one of the following constraints: ` isForeachIterable!Iterable __traits(compiles, Parameters!(Parameters!(r.opApply)))` ``` -- |
Copyright © 1999-2021 by the D Language Foundation