-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda as UDA is valid but spec requires brackets #4137
Comments
hsteoh commented on 2024-01-20T01:34:51ZI'm inclined to say that parentheses should be required, for consistency with the single-token requirement on unparenthesized UDAs. (Cf also binary `!` syntax, where the unparenthesized version also requires exactly 1 token, and in all other cases parentheses are required.) |
Allowing this breaks shortened function bodies: struct UDA {}
int foo() @UDA => 123;
void main()
{
assert(foo() == 123);
// error: undefined reference to '_D9onlineapp3fooFZi'
} In the above code, |
From the linked forum discussion (https://forum.dlang.org/post/[email protected])
But IMHO the implementation is harmful, it prevents use of Shortened Function Declarations. And so the severity of the bug should be bumped, to get some attention. It should be decided if it is a spec bug, or parser bug and handled accordingly. |
This brings the compiler's behavior in line with the language spec. Fixes dlang/dlang.org#4137
This brings the compiler's behavior in line with the language spec. Fixes dlang/dlang.org#4137
This brings the compiler's behavior in line with the language spec. Fixes dlang/dlang.org#4137
This brings the compiler's behavior in line with the language spec. Fixes dlang/dlang.org#4137
This brings the compiler's behavior in line with the language spec. Fixes dlang/dlang.org#4137
Richard (Rikki) Andrew Cattermole reported this on 2024-01-20T01:25:08Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=24346
CC List
Description
The text was updated successfully, but these errors were encountered: