[Issue 21263] New: Improve error message for anonymous lambda
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Sep 18 07:24:05 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21263
Issue ID: 21263
Summary: Improve error message for anonymous lambda
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ali.akhtarzada at gmail.com
A lot of the time when you use anonymous templates lambdas, the errors result
in identifying the lambda by their internal name (e.g. __lambda1). These
lambdas usually have an identifier associated with them so why not show that
identifier in the error message?
In the code:
template match(handlers...) {
...
alias handlerOne = handlers[0];
...
handlerOne(); // Error
}
that results in:
source/optional/match.d(28,53): Error: function literal __lambda3() is not
callable using argument types (inout(int))
source/optional/match.d(28,53): expected 0 argument(s), not 1
Suggestion to have it result in:
Error: anonymous function __lambda3, identified as handlerOne, is not callable
using argument types (inout(int)).
--
More information about the Digitalmars-d-bugs
mailing list