Display 'readonly' for record structs#53634
Conversation
|
@jcouv for compiler sign-off @dotnet/roslyn-ide for a small test sign-off |
| public async Task QuickInfoReadOnlyRecordStruct() | ||
| { | ||
| await TestWithOptionsAsync( | ||
| Options.Regular.WithLanguageVersion(LanguageVersion.CSharp9), |
There was a problem hiding this comment.
I just noticed I unintentionally left the language version from copy/pasting the test above. But the test should probably fail with C# 9.0
However, It's passing (CI test jobs has finished). Feels weird.
Edit: This is okay, the produced compilation has diagnostics as expected, but this doesn't prevent "correct" symbols from being created.
There was a problem hiding this comment.
That's expected. It should pass in C# 9. With some rare exceptions, we always bind in the latest version of the language, only producing different diagnostics. So the symbol is the same regardless of language version.
| break; | ||
|
|
||
| case TypeKind.Struct when symbol.IsRecord: | ||
| // In case ref record structs are allowed in future, call AddKeyword(SyntaxKind.RefKeyword) and remove assertion. |
There was a problem hiding this comment.
nit: The comment probably isn't needed
| break; | ||
|
|
||
| case TypeKind.Struct when symbol.IsRecord: | ||
| // In case ref record structs are allowed in future, call AddKeyword(SyntaxKind.RefKeyword) and remove assertion. |
There was a problem hiding this comment.
| // In case ref record structs are allowed in future, call AddKeyword(SyntaxKind.RefKeyword) and remove assertion. |
|
Merged/squashed. Thanks @Youssef1313 |
…ures/interpolated-string * upstream/main: (92 commits) Keep casts when necessary to prefer a constant pattern over a type pattern Remove SyntaxKind.DataKeyword (#53614) Display 'readonly' for record structs (#53634) Update Building, Debugging, and Testing on Windows.md (#53543) Update dependencies from https://github.com/dotnet/arcade build 20210521.3 (#53617) Introduce resx for BuildValidator and MS.CA.Rebuild to allow localization (#53447) Report obsoletion diagnostics for slice and indexer (#53463) Update BasicGenerateConstructorDialog.cs Add searchbox in generate overrides dialog Allow `with` on anonymous types (#53248) Report diagnostic on correct node (#53538) Fix NotNullIfNotNull delegate conversion (#53409) Verify quick info session in InvokeQuickInfo Remove unnecessary retry Ensure no navbar IO on the UI thread Enable nullable reference types Fix timeout behavior in GetQuickInfo Add a semantic model based GetQuickInfoAsync entry point into QuickInfoServiceWithProviders Move semantic model based quick info API up to CommonQuickInfoProvider type Fix dnceng build by forcing the use of xcopy msbuild ...
Part of #53631.