Account for a ref returning lambda as a local variable initializer.#56814
Account for a ref returning lambda as a local variable initializer.#56814AlekseyTs merged 2 commits intodotnet:release/dev17.0from
Conversation
| N(SyntaxKind.EndOfFileToken); | ||
| } | ||
| EOF(); | ||
| } |
There was a problem hiding this comment.
Ideally, the parser should allow lambdas with ref return types without parentheses in other locations as well, such as argument expressions.
F(ref int () => throw null);
static void F(System.Delegate d)
{
}It looks like #54258 may have narrowed the scope of what was intended from language design. #Resolved
|
@cston Please review. |
|
@jcouv Please review changes in the second commit |
jcouv
left a comment
There was a problem hiding this comment.
LGTM Thanks (iteration 2). Should we have any compilation tests (currently only added parsing tests)?
I believe we have plenty of tests covering binding of ref returning lambdas. This change doesn't introduce a new shape of a parse tree, it creates an old shape of a lambda node in more scenarios. |
Fixes #54258.