Fix parsing of scoped before this in parameter list
#80718
Draft
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.
Fix parsing of
scopedbeforethisin parameter list ✅Summary
Fixed a parser bug where
scoped in this intfailed to parse even though the ordering ofthiskeyword was supposed to be relaxed according to LDM notes.Changes Made
Parser Fix (
LanguageParser.cs:4884):Parsing Tests Added (
DeclarationScopeParsingTests.cs):ScopedWithThis_01:scoped in this int(main failing case)ScopedWithThis_02:scoped ref this intScopedWithThis_03:scoped ref readonly this intScopedWithThis_04:this scoped in int(regression test)Attribute Tests Added (
AttributeTests_LifetimeAnnotation.cs):EmitAttribute_ExtensionMethodParameters_ScopedInThisEmitAttribute_ExtensionMethodParameters_ScopedRefThisEmitAttribute_ExtensionMethodParameters_ScopedRefReadonlyThisTest Results
✅ All new parsing tests pass (4/4)
✅ All new attribute tests pass (3/3)
✅ All existing tests pass
Manual Verification
All issue scenarios now work correctly:
Impact
Minimal surgical change - one line modified in parser logic to support the relaxed ordering of parameter modifiers as intended by the language design.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.