Skip to content

allow unsafe and ref in grammar #943

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

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

BillWagner
Copy link
Member

unsafe and ref returns are allowed for delegates, local functions, and methods. Update the grammar for that part.

Fixes #886

See #941 (review)

`unsafe` and ref returns are allowed for delegates, local functions, and methods. Update the grammar for that part.

Fixes dotnet#886

See dotnet#941 (review)
This change from dotnet#941 should be made in 7.3
Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

I think this works, but @Nigel-Ecma may well have a nicer way of representing it. It would be nice to avoid all the branching - if we had a rule of "return_type or ref_kind + ref_return_type" then we could remove some duplication. We'd need to explicitly prohibit async ref local functions (rather than doing it in the grammar) but this wouldn't be the first time we did that sort of thing.

@KalleOlaviNiemitalo
Copy link
Contributor

Will the grammar summary be updated automatically after this is merged?

@BillWagner BillWagner added the meeting: discuss This issue should be discussed at the next TC49-TG2 meeting label Sep 20, 2023
@Nigel-Ecma
Copy link
Contributor

I think this works, but @Nigel-Ecma may well have a nicer way of representing it. It would be nice to avoid all the branching - if we had a rule of "return_type or ref_kind + ref_return_type" then we could remove some duplication. We'd need to explicitly prohibit async ref local functions (rather than doing it in the grammar) but this wouldn't be the first time we did that sort of thing.

I'll take a look but not before the meeting…

@Nigel-Ecma
Copy link
Contributor

Will the grammar summary be updated automatically after this is merged?

Yes :-)

@jskeet jskeet added this to the C# 7.x milestone Sep 20, 2023
@jskeet jskeet merged commit 23975a0 into dotnet:draft-v7 Sep 20, 2023
@BillWagner BillWagner deleted the unsafe-ref-grammar branch September 20, 2023 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meeting: discuss This issue should be discussed at the next TC49-TG2 meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate combinations of unsafe & ref
5 participants