-
Notifications
You must be signed in to change notification settings - Fork 88
Grammar rule *parameter_modifier* disallows valid V7 constructs #1209
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
Open
RexJaeschke
wants to merge
1
commit into
dotnet:draft-v8
Choose a base branch
from
RexJaeschke:parameter-modifier
base: draft-v8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2130,7 +2130,7 @@ default_argument | |
|
||
parameter_modifier | ||
: parameter_mode_modifier | ||
| 'this' | ||
| 'this' parameter_mode_modifier? | ||
; | ||
|
||
parameter_mode_modifier | ||
|
@@ -3056,6 +3056,7 @@ When the first parameter of a method includes the `this` modifier, that method i | |
|
||
- It may only be an input parameter if it has a value type | ||
- It may only be a reference parameter if it has a value type or has a generic type constrained to struct | ||
- It shall not be an output parameter. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we're here, is it worth being consistent within this bullet list as to whether we end with a period or not? |
||
- It shall not be a pointer type. | ||
|
||
> *Example*: The following is an example of a static class that declares two extension methods: | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ordering is flexible:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My test shows that the order is indeed flexible. Given Nigel's proposal,
this
on its own would be ambiguous, but I think ANTLR chooses the lexical-first rule that matches, right, Nigel?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RexJaeschke – Yes, ANTLR resolves such ambiguity by picking the first alternative. We have noted elsewhere where the grammar relies on this, however in this case as the two alternatives represent exactly the same thing I don’t think a note is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not originally so flexible, see https://github.com/dotnet/csharplang/blob/8bd52cca31b40d9720a98629aae9a0cd89bb92ec/meetings/2017/LDM-2017-12-04.md. But I'm not sure which version of C# got that change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Roslyn change was dotnet/roslyn#23643. According to dotnet/csharplang#1022, this change is in C# 7.3. So OK for the ECMA C# 7 spec.