-
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
Combine nearby loops to prevent crash building dotnet/runtime #46980
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 |
---|---|---|
|
@@ -1216,19 +1216,14 @@ public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations | |
if (anyToRemove) | ||
{ | ||
var explicitInterfaceImplementationsBuilder = ArrayBuilder<MethodSymbol>.GetInstance(); | ||
MethodSymbol uniqueClassOverride = null; | ||
foreach (var method in explicitlyOverriddenMethods) | ||
{ | ||
if (method.ContainingType.IsInterface) | ||
{ | ||
explicitInterfaceImplementationsBuilder.Add(method); | ||
} | ||
} | ||
|
||
explicitInterfaceImplementations = explicitInterfaceImplementationsBuilder.ToImmutableAndFree(); | ||
|
||
MethodSymbol uniqueClassOverride = null; | ||
foreach (MethodSymbol method in explicitlyOverriddenMethods) | ||
{ | ||
if (method.ContainingType.IsClassType()) | ||
{ | ||
if (uniqueClassOverride is { }) | ||
|
@@ -1242,6 +1237,8 @@ public override ImmutableArray<MethodSymbol> ExplicitInterfaceImplementations | |
} | ||
} | ||
|
||
explicitInterfaceImplementations = explicitInterfaceImplementationsBuilder.ToImmutableAndFree(); | ||
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.
Would it be easier to remove the loop entirely from the method, to avoid the complexity of handling both in the same loop:
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.
Thanks for catching this. I did change semantics by accident. 😉 I am thinking perhaps we should try @davidwrighton's suggestion for now to just apply |
||
|
||
if (uniqueClassOverride is { }) | ||
{ | ||
Interlocked.CompareExchange(ref AccessUncommonFields()._lazyExplicitClassOverride, uniqueClassOverride, null); | ||
|
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.
else if