Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
April 28 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in a expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@geany.org Severity|normal |enhancement --- Comment #1 from Nick Treleaven <nick@geany.org> --- Under https://dlang.org/spec/statement.html#NonEmptyStatementNoCaseNoDefault grammar block it says: > Any ambiguities in the grammar between Statements and Declarations are resolved by the declarations taking precedence. For: > ref () {return a;}() = 0; A declaration `ref () {return a;}` gets parsed, not an ExpressionStatement. So I think this issue is invalid. It is unfortunate that the function literal syntax starting `ref` or `auto ref` was added, when the function/delegate keyword starting forms can already handle those. -- |
April 28 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in a expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal --- Comment #2 from Nick Treleaven <nick@geany.org> --- > A declaration `ref () {return a;}` gets parsed Sorry, that may be what is happening, but there is no identifier for the declaration, so it should try to parse an ExpressionStatement. -- |
April 29 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in a expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 --- Comment #3 from basile-z <b2.temp@gmx.com> --- > Any ambiguities in the grammar between Statements and Declarations are resolved by the declarations taking precedence. yes, I remember the spec about decl/stmt ambiguities but here I think there are none. The parser should lookup after `auto`. If next is `(` or if next two are `ref` then `(`, then it should takes the path of expression. > It is unfortunate that the function literal syntax starting `ref` or `auto ref` was added, when the function/delegate keyword starting forms can already handle those. Indeed. But I'll show you the context: ``` void main() { int a,b,c,d,cond; auto ref () { switch (cond) { case 1: return a; case 2: return b; case 3: return c; default: return d; } }() = 0; } ``` Here, given the size of the lambda, you try to avoid the verbose solution (you can put the lambda between parens however, but according to the specs, that should work w/o). -- |
April 29 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in an expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|auto ref lambda exp not |auto ref lambda exp not |parsed if used as left-most |parsed if used as left-most |expression in a expression |expression in an expression |statement |statement -- |
April 30 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in an expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|nobody@puremagic.com |nick@geany.org -- |
May 01 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in an expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- @ntrel created dlang/dmd pull request #16431 "Fix Bugzilla 24525 - ref lambda not parsed at start of ExpressionStat…" fixing this issue: - Fix Bugzilla 24525 - ref lambda not parsed at start of ExpressionStatement https://github.com/dlang/dmd/pull/16431 -- |
May 02 [Issue 24525] auto ref lambda exp not parsed if used as left-most expression in an expression statement | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24525 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #16431 "Fix Bugzilla 24525 - ref lambda not parsed at start of ExpressionStat…" was merged into master: - 3c3be0716da1b6d2cdbe2ca6517a8b1cec6d7ae2 by Nick Treleaven: Fix Bugzilla 24525 - ref lambda not parsed at start of ExpressionStatement https://github.com/dlang/dmd/pull/16431 -- |
Copyright © 1999-2021 by the D Language Foundation