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

Ensure that side effects of conditional access on an instance of a nullable type are not preserved in generic code #66250

Merged
merged 2 commits into from
Jan 7, 2023

Conversation

AlekseyTs
Copy link
Contributor

Fixes #66152.

…llable type are not preserved in generic code

Fixes dotnet#66152.
@AlekseyTs AlekseyTs requested a review from a team as a code owner January 4, 2023 23:21
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review.

1 similar comment
@AlekseyTs
Copy link
Contributor Author

@dotnet/roslyn-compiler Please review.

@@ -1704,6 +1704,7 @@
matching Id that are integers unique for the containing method body.
-->
<Field Name="Id" Type="int"/>
<Field Name="ForceCopyOfNullableValueType" Type="bool"/>
Copy link
Member

Choose a reason for hiding this comment

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

📝 Note to future self: For conditional access we do want a copy when dealing with an unconstrained type, for the nullable value type scenario to behave properly.
But we also use this bound node in a few other scenarios (string concat and fixed statement) that need different semantics (we shouldn't get any copy).

Copy link
Member

@jcouv jcouv left a 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)

@jcouv jcouv self-assigned this Jan 6, 2023
@AlekseyTs AlekseyTs merged commit b6c90bf into dotnet:main Jan 7, 2023
@ghost ghost added this to the Next milestone Jan 7, 2023
@Cosifne Cosifne modified the milestones: Next, 17.6 P1 Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Side effects of conditional access on an instance of a nullable type are preserved in generic code
5 participants