Skip to content

Account for a ref returning lambda as a local variable initializer.#56814

Merged
AlekseyTs merged 2 commits intodotnet:release/dev17.0from
AlekseyTs:Issue54258
Sep 29, 2021
Merged

Account for a ref returning lambda as a local variable initializer.#56814
AlekseyTs merged 2 commits intodotnet:release/dev17.0from
AlekseyTs:Issue54258

Conversation

@AlekseyTs
Copy link
Contributor

Fixes #54258.

@AlekseyTs AlekseyTs requested review from a team and cston September 28, 2021 18:06
@jcouv jcouv self-assigned this Sep 28, 2021
Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 1)

@jcouv jcouv added this to the 17.0 milestone Sep 28, 2021
N(SyntaxKind.EndOfFileToken);
}
EOF();
}
Copy link
Contributor

@cston cston Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

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

@jcouv jcouv self-requested a review September 29, 2021 02:38
@AlekseyTs
Copy link
Contributor Author

@cston Please review.

@AlekseyTs
Copy link
Contributor Author

@jcouv Please review changes in the second commit

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 2). Should we have any compilation tests (currently only added parsing tests)?

@AlekseyTs
Copy link
Contributor Author

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.

@AlekseyTs AlekseyTs merged commit 4f08602 into dotnet:release/dev17.0 Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants