Bump Roslyn to 5.9.0 to accept the C# 15 closed modifier - #93
Merged
Merged
Conversation
Roslyn 5.6.0 does not recognise `closed` as a valid modifier for `record class` or `class` declarations. Files using it were reported as unparsable and left unformatted. Roslyn 5.9.0, now the head-of-published version on NuGet, parses them cleanly at `LanguageVersion.Preview`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Files using the C# 15
closedmodifier onrecord classorclasswere reported as unparsable and left unformatted. BumpingMicrosoft.CodeAnalysis.CSharpfrom5.6.0to5.9.0— now the head-of-published version on NuGet — fixes the parse failure.Prompt summary: Fix the parse failure reported in #92: files using the
closedmodifier are silently skipped rather than formatted.Why
Roslyn
5.6.0does not recogniseclosedas a valid modifier inLanguageVersion.Preview. Any file with aclosed record classorclosed classdeclaration produces aCS1002: ; expecteddiagnostic, which causesCSharpSource.TryParseto refuse the file outright. Roslyn5.9.0adds the missing grammar production and parses these declarations cleanly.What
Roslyn version pin
The
Microsoft.CodeAnalysis.CSharpexact-version pin inDirectory.Packages.propsmoves from[5.6.0]to[5.9.0]. The inline comment was also stale — it claimed5.6.0was head-of-published;5.9.0is the new head. The note explaining why the SDK-bundled compiler is not matched is unchanged.Regression test
ParsingTests.Accepts_C15_closed_modifierlocks in the fix using the minimal repro from the issue: aclosed record classwith a sealed subtype. The test would have caught5.6.0immediately.Verify
dotnet run --project tests/Nullean.Curb.Tests/ # Accepts_C15_closed_modifier — new test, must pass🤖 Generated with Claude Code