dotnet / dotnet/roslyn

Parsing of `scoped` before `this` in parameter list fails

Open
#78,556 0 comments 1 reaction 2 assignees Claimed by @jcouv View on GitHub
Area-Compilers Feature - Ref Fields
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

The expected ordering for `this` keyword in parameter list has been relaxed according to [these LDM notes](https://github.com/dotnet/csharplang/blob/main/meetings/2017/LDM-2017-12-04.md#this-ref-vs-ref-this), so `in this int` and `this in int` both parse.
But `scoped in this int` doesn't parse, while `this scoped in int` parses.

The logic is in `ParseParameterModifiers` and it doesn't look for `this` after it found a "scoped" that is recognized as a keyword.

Reported by @tannergooding in https://github.com/dotnet/roslyn/issues/78491#issuecomment-2874732874
Tagging @cston to confirm expectations

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.