Bug 21263 – Improve error message for anonymous lambda

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2020-09-18T07:24:05Z
Last change time
2024-12-13T19:11:38Z
Assigned to
No Owner
Creator
Ali Ak
Moved to GitHub: dmd#19790 →

Comments

Comment #0 by ali.akhtarzada — 2020-09-18T07:24:05Z
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)).
Comment #1 by robert.schadek — 2024-12-13T19:11:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19790 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB