dotnet/roslyn
Improve parser error recovery for misplaced `ref` modifier of a struct declaration
开放
#84,734 创建于 2026年8月2日
Area-CompilersFeature - Ref Fieldshelp wanted
仓库指标
- 星标
- (20,414 个星标)
- PR 合并指标
- (平均合并 6天 17小时) (30 天内合并 256 个 PR)
描述
Case 1:
Snippet:
ref public struct MyStruct;
Expected:
ref is in the modifiers list for MyStruct, error about its misplacement
Actual:
ref is a part of RefTypeSyntax of IncompleteMemberSyntax while StructDeclarationSyntax starts from a public token. The error is 'Type expected' on public token
Case 2:
Snippet:
partial ref struct MyStruct;
Expected:
partial is in the modifiers list for MyStruct, error about its misplacement
Actual:
partial is its own IncompleteMemberSyntax. The error is on ref keyword saying about its misplacement instead