digitalmars.D.bugs - [Issue 20625] New: Function literal diagnostic is not on par with
- d-bugmail puremagic.com (50/50) Mar 02 2020 https://issues.dlang.org/show_bug.cgi?id=20625
https://issues.dlang.org/show_bug.cgi?id=20625 Issue ID: 20625 Summary: Function literal diagnostic is not on par with other messages Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: pro.mathias.lang gmail.com The following code: ``` void main() { // No argument (x, y, z) { return 42; }(); // Too many args, non-variadic (x, y, z) { return 42; }(42, "Hello", 42, 42); // Too many args, non-variadic, default param (x, y, string z = "Hello") { return x; }(42, 42, "Nope", "Noooope"); // Too few args, non-variadic (x, y, string z = "Hello") { return x; }(42); // Too few args, non-variadic, default param (x, y, z) { return x; }(42); // Too few args, variadic (x, y, ...) { return x; }(42); // Too few args, variadic, default param (x, y, string z = "Hey", ...) { return x; }(42); } ``` Outputs the following: ``` diag1111.d(4): Error: function literal __lambda1(x, y, z) is not callable using argument types () diag1111.d(7): Error: cannot infer function literal type diag1111.d(9): Error: cannot infer function literal type diag1111.d(11): Error: cannot infer function literal type diag1111.d(13): Error: cannot infer function literal type diag1111.d(16): Error: cannot infer function literal type diag1111.d(18): Error: cannot infer function literal type ``` You can see that the first error message, with no argument, is pretty good, while the other error messages are much poorer. --
Mar 02 2020