Bug 20268 – anonymous function parameter mismatch errors don't include parameters

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-05T01:48:12Z
Last change time
2023-05-06T20:29:22Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
elpenguino+D
See also
https://issues.dlang.org/show_bug.cgi?id=23897

Comments

Comment #0 by elpenguino+D — 2019-10-05T01:48:12Z
As of DMD 2.088.0, the error messages for mismatching parameters provide no hint about an anonymous function's expected parameters. For example, ``` alias f = (x,y) => true; auto x = f(1); ``` currently results in an error like ``` onlineapp.d(3): Error: template D main.__lambda1 cannot deduce function from argument types !()(int), candidates are: onlineapp.d(2): onlineapp.main.__lambda1 ``` Compare with typical functions: ``` bool f(X,Y)(X,Y) { return true; } auto x = f(1); ``` results in ``` onlineapp.d(3): Error: template D main.f cannot deduce function from argument types !()(int), candidates are: onlineapp.d(2): onlineapp.main.f(X, Y)(X, Y) ```
Comment #1 by dlang-bot — 2023-04-18T09:33:42Z
@RazvanN7 created dlang/dmd pull request #15113 "Fix Issue 20268 - anonymous function parameter mismatch errors don't …" fixing this issue: - Fix Issue 20268 - anonymous function parameter mismatch errors don't include parameters https://github.com/dlang/dmd/pull/15113
Comment #2 by dlang-bot — 2023-04-20T08:20:55Z
dlang/dmd pull request #15113 "Fix Issue 20268 - anonymous function parameter mismatch errors don't …" was merged into master: - 6197bb7a518dddff4684bd64b74a1d7ffab5810f by RazvanN7: Fix Issue 20268 - anonymous function parameter mismatch errors don't include parameters https://github.com/dlang/dmd/pull/15113