-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for converting an auto-prop to a field-backed property. #76900
Conversation
@@ -41,23 +42,9 @@ protected override bool SupportsReadOnlyProperties(Compilation compilation) | |||
protected override bool SupportsPropertyInitializer(Compilation compilation) | |||
=> compilation.LanguageVersion() >= LanguageVersion.CSharp6; | |||
|
|||
protected override bool SupportsFieldExpression(Compilation compilation) | |||
=> compilation.LanguageVersion() >= LanguageVersion.Preview; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to SyntaxFacts, where we have our other checks.
@@ -18,7 +19,7 @@ namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.UseImplicitlyTypedLambd | |||
[Trait(Traits.Feature, Traits.Features.CodeActionsUseImplicitObjectCreation)] | |||
public sealed class UseImplicitlyTypedLambdaExpressionTests | |||
{ | |||
private static readonly LanguageVersion CSharp14 = LanguageVersion.Preview; | |||
private static readonly LanguageVersion CSharp14 = LanguageVersionExtensions.CSharpNext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use CSharpNext as there's a process where we look for this when adding the actual CSharp14 LangVersion before shpping that release.
CSharpCodeGenerationContextInfo info, | ||
PropertyDeclarationSyntax property, | ||
ExpressionSyntax backingFieldExpression, | ||
CancellationToken cancellationToken) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
view with whitespace off.
M(field); | ||
field = value; | ||
M(p); | ||
p = value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was a bug fix. when converting these to a full property, 'field' should be replaced with the final field name.
Fixes #76899
Fixes #76901
Looks like: