-
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
Move merging of partial members to an earlier phase of members construction. #76871
base: main
Are you sure you want to change the base?
Conversation
…uction. Fixes dotnet#76651. Fixes dotnet#75002. Related to dotnet#76842. Related to dotnet#76870.
@RikkiGibson, @cston, @dotnet/roslyn-compiler Please review |
@jjonescz, FYI |
} | ||
} | ||
|
||
void mergePartialMethods(ArrayBuilder<Symbol> nonTypeMembers, SourceOrdinaryMethodSymbol currentMethod, SourceOrdinaryMethodSymbol prevMethod, BindingDiagnosticBag diagnostics) |
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.
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.
static?
I do not think I changed anything that affects ability to place the modifier on the method. Therefore, I won't try adding it, unless there is other feedback to take care of.
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.
Scratch that, it looks like I removed DuplicateMembersByNameIfCached
call
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.
It looks like the containing method MergePartialMembers
could be marked static too
} | ||
} | ||
|
||
void mergePartialProperties(ref Dictionary<ReadOnlyMemory<char>, ImmutableArray<Symbol>> membersByName, ReadOnlyMemory<char> name, SourcePropertySymbol currentProperty, SourcePropertySymbol prevProperty, BindingDiagnosticBag diagnostics) | ||
void mergePartialProperties(ArrayBuilder<Symbol> nonTypeMembers, SourcePropertySymbol currentProperty, SourcePropertySymbol prevProperty, BindingDiagnosticBag diagnostics) |
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.
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.
static?
Same response
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.
LGTM Thanks (iteration 2)
@RikkiGibson, @cston, @dotnet/roslyn-compiler For the second review |
1 similar comment
@RikkiGibson, @cston, @dotnet/roslyn-compiler For the second review |
} | ||
|
||
private static ImmutableArray<Symbol> Remove(ImmutableArray<Symbol> symbols, Symbol symbol) | ||
private static void Remove(ArrayBuilder<Symbol> symbols, Symbol symbol) |
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.
It looks like we call Remove
once for each partial method or property that has both parts. Does the symbols
array contain all non-type members? If that's the case, the number of ReferenceEquals()
calls across all Remove
calls for the containing type will be roughly N*M where N is the number of non-type members and M is the number of partial members. Are there cases where that might be an issue?
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.
Are there cases where that might be an issue?
It is hard to tell for sure. I assume that ReferenceEquals
call is pretty fast, since it is optimized away and probably roughly close to a pointer comparison. Also, M is likely not very big and no more than N/2. Also, on average, the match will be found before we check all N items, and each removal decreases N by one.
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.
The M
that I am using is not the number of partial members. It is the number of partial members that we are going to remove, which is no more than the number of partial members divided by two.
src/Compilers/CSharp/Portable/Symbols/Source/SourcePropertySymbolBase.cs
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol.cs
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Revert the rename.
This reverts commit e3d2282.
Fixes #76651.
Fixes #75002.
Related to #76842.
Related to #76870.