-
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
Ensure that side effects of conditional access on an instance of a nullable type are not preserved in generic code #66250
Conversation
…llable type are not preserved in generic code Fixes dotnet#66152.
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_NullCoalescingOperator.cs
Outdated
Show resolved
Hide resolved
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UnaryOperator.cs
Outdated
Show resolved
Hide resolved
@dotnet/roslyn-compiler Please review. |
1 similar comment
@dotnet/roslyn-compiler Please review. |
Co-authored-by: Jan Jones <[email protected]>
@@ -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"/> |
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.
📝 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).
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)
Fixes #66152.