-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Fixup partial property API usage #74951
Fixup partial property API usage #74951
Conversation
// The partial definition part may include optional parameters whose default values we want to simulate assigning at the beginning of the method | ||
// https://github.com/dotnet/roslyn/issues/73772: is this actually used/meaningful? | ||
methodSymbol = methodSymbol.PartialDefinitionPart ?? methodSymbol; |
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 and the other deleted usage of partial APIs in nullable are no longer necessary per https://github.com/dotnet/csharplang/blob/main/proposals/nullable-parameter-default-value-analysis.md#suggested-change-to-declaration-analysis.
@@ -1591,6 +1591,15 @@ internal override void ForceComplete(SourceLocation? locationOpt, Predicate<Symb | |||
} | |||
|
|||
DeclaringCompilation.SymbolDeclaredEvent(this); | |||
if (this.IsPartialDefinition()) |
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 check is similar in purpose to the following check performed for ordinary methods. Essentially it seems that MethodCompiler will report the SymbolDeclaredEvents for implementation parts of partial methods (including property accessors). But for the definition parts, the symbol itself must do it.
roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceOrdinaryMethodSymbol.cs
Lines 279 to 285 in eea02d9
protected sealed override void CompleteAsyncMethodChecksBetweenStartAndFinish() | |
{ | |
if (IsPartialDefinition) | |
{ | |
DeclaringCompilation.SymbolDeclaredEvent(this); | |
} | |
} |
@dotnet/roslyn-compiler for review |
@dotnet/roslyn-compiler for second review |
} | ||
if (member is IMethodSymbol { PartialImplementationPart: { } methodImplementation }) | ||
memberSet.Add(methodImplementation); | ||
else if (member is IPropertySymbol { PartialImplementationPart: { } propertyImplementation }) |
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.
Will we need to fix this up for field
, with property initializers on the implementation part?
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.
I don't think this code would need to do anything differently based on the implementation part having an initializer. We also don't expect any backing field to be included in the set because IsImplicitlyDeclared
will always be true
on it.
Related to #73772
This PR addresses the remaining issues in compiler layer.
I started to work through the remaining IDE issues in #74950, but struggled to determine the correct change to make in some cases, and also struggled to write and interpret results of tests in certain areas such as Find References.