Skip to content

Enforce new grammar rules that scoped keyword must be immediately followed by a type possibly “prefixed” by ref/ref readonly/in/out.#64088

Merged
AlekseyTs merged 2 commits intodotnet:mainfrom
AlekseyTs:Issue62039_02
Sep 19, 2022
Merged

Conversation

@AlekseyTs
Copy link
Contributor Author

@cston, @dotnet/roslyn-compiler Please review

1 similar comment
@AlekseyTs
Copy link
Contributor Author

@cston, @dotnet/roslyn-compiler Please review

while (IsParameterModifierExcludingScoped(this.CurrentToken))
{
if (this.CurrentToken.ContextualKind == SyntaxKind.ScopedKeyword)
if (this.CurrentToken.Kind is SyntaxKind.RefKeyword or SyntaxKind.OutKeyword or SyntaxKind.InKeyword)
Copy link
Contributor

@cston cston Sep 19, 2022

Choose a reason for hiding this comment

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

)

or SyntaxKind.ReadOnlyKeyword perhaps? #WontFix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or SyntaxKind.ReadOnlyKeyword perhaps?

That is not needed for any valid scenario. And it is really questionable if that would add any value for an error scenario. Going as is for now.

@AlekseyTs
Copy link
Contributor Author

@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler For the second review

@RikkiGibson RikkiGibson self-assigned this Sep 19, 2022
{
SyntaxToken scopedKeyword = ParsePossibleScopedKeyword(isFunctionPointerParameter: false);

// For local functions, 'scoped' is a modifier in LocalFunctionStatementSyntax
Copy link
Member

@RikkiGibson RikkiGibson Sep 19, 2022

Choose a reason for hiding this comment

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

Is an error reported if a local function has the scoped modifier? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is an error reported if a local function has the scoped modifier?

Yes. There is a test for that. ReturnTypeScope in RefFieldTest.cs, for example.

@AlekseyTs AlekseyTs merged commit 1f8b9e9 into dotnet:main Sep 19, 2022
@ghost ghost added this to the Next milestone Sep 19, 2022
@Cosifne Cosifne modified the milestones: Next, 17.4 P3 Sep 26, 2022
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.

4 participants