-
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
Fix null coalescing operator emit with span conversion #75103
Fix null coalescing operator emit with span conversion #75103
Conversation
bca6980
to
6029531
Compare
Debug.Assert(rewrittenLeft.Type is { }); | ||
if (rewrittenLeft.Type.IsReferenceType && | ||
BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsImplicit: true, IsUserDefined: false }) | ||
BoundNode.GetConversion(leftConversion, leftPlaceholder) is { IsImplicit: true, IsUserDefined: false, IsSpan: false }) |
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.
Given the original comment above the if
, it feels like the condition was a somewhat "roundabout" way of checking for an implicit reference conversion. With the additional condition we are still trying to check for what we are not looking for rather than checking for what we are looking for. Consider adjusting condition accordingly in order to make it more robust in the long run.
Done with review pass (commit 1) |
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 (commit 2)
@333fred for another look as there was a small product code change, thanks |
A bug discovered while running runtime tests (would be also discovered by building runtime with Debug version of roslyn but currently there are other unrelated asserts so I haven't tried that).
Test plan: #73445