Skip to content
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

Conversation

jjonescz
Copy link
Member

@jjonescz jjonescz commented Sep 13, 2024

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

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 13, 2024
@jjonescz jjonescz force-pushed the FirstClassSpan-20-NullCoalesce branch from bca6980 to 6029531 Compare September 13, 2024 13:17
@jjonescz jjonescz marked this pull request as ready for review September 13, 2024 14:17
@jjonescz jjonescz requested a review from a team as a code owner September 13, 2024 14:17
@jjonescz jjonescz requested review from 333fred and cston September 13, 2024 14:18
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 })
Copy link
Contributor

@AlekseyTs AlekseyTs Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsSpan: false

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.

@AlekseyTs
Copy link
Contributor

Done with review pass (commit 1)

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 2)

@AlekseyTs AlekseyTs requested a review from 333fred September 19, 2024 16:14
@jjonescz
Copy link
Member Author

@333fred for another look as there was a small product code change, thanks

@jjonescz jjonescz merged commit 9ddc1e7 into dotnet:features/FirstClassSpan Oct 2, 2024
24 checks passed
@jjonescz jjonescz deleted the FirstClassSpan-20-NullCoalesce branch October 2, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Feature - First-class Span Types untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants