Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 20, 2025

The grammar already supports scoped ref but lacked test coverage for the reverse order ref scoped, which is also valid C# syntax.

Changes:

  • Added tests for ref scoped in method parameters and local variable declarations
  • Extended grammar patterns to explicitly handle ref scoped in addition to scoped ref
  • Updated capture groups to use dynamic modifier names for both readonly and scoped after ref

Example:

// Method parameter with ref scoped
public static Span<T> CreateSpan<T>(ref scoped T reference, int length) {}

// Local variable with ref scoped
ref scoped Span<int> x = stackalloc int[42];
ref scoped var y = ref z;

All 864 tests passing.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: JoeRobich <611219+JoeRobich@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for scoped ref modifier Add test coverage for ref scoped modifier Dec 20, 2025
Copilot AI requested a review from JoeRobich December 20, 2025 03:52
@JoeRobich JoeRobich closed this Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants