-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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 commentThe 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
|
||||||||||||||||
{ | ||||||||||||||||
if (_getMethod is not null) | ||||||||||||||||
DeclaringCompilation.SymbolDeclaredEvent(_getMethod); | ||||||||||||||||
|
||||||||||||||||
if (_setMethod is not null) | ||||||||||||||||
DeclaringCompilation.SymbolDeclaredEvent(_setMethod); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
var completedOnThisThread = _state.NotePartComplete(CompletionPart.FinishPropertyParameters); | ||||||||||||||||
Debug.Assert(completedOnThisThread); | ||||||||||||||||
} | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,13 +204,10 @@ void processMembers(IEnumerable<ISymbol> members) | |
memberSet ??= new HashSet<ISymbol>(); | ||
memberSet.Add(member); | ||
|
||
// Ensure that we include symbols for both parts of partial methods. | ||
// https://github.com/dotnet/roslyn/issues/73772: also cascade to partial property implementation part | ||
if (member is IMethodSymbol method && | ||
!(method.PartialImplementationPart is null)) | ||
{ | ||
memberSet.Add(method.PartialImplementationPart); | ||
} | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Will we need to fix this up for There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
memberSet.Add(propertyImplementation); | ||
} | ||
|
||
if (member is INamedTypeSymbol typeMember) | ||
|
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.