Skip to content

Conversation

RikkiGibson
Copy link
Member

@RikkiGibson RikkiGibson commented Jan 30, 2022

Closes #34556 (replacing an old PR)
Closes #32671
Closes #49575

chsienki and others added 4 commits March 28, 2019 11:46
- Add a VisitOperandsHonoringAnnotations that will split the state if needed based on annotations
- Call it from user defined conversions and binary operators
- Add tests
@ghost ghost added the Area-Compilers label Jan 30, 2022
@RikkiGibson RikkiGibson force-pushed the nullable-conv-annotations branch from d81bf7f to ecfe673 Compare January 31, 2022 03:37
@RikkiGibson RikkiGibson marked this pull request as ready for review January 31, 2022 04:04
@RikkiGibson RikkiGibson requested a review from a team as a code owner January 31, 2022 04:04
@cston
Copy link
Contributor

cston commented Feb 2, 2022

                rightState = VisitOptionalImplicitConversion(right, targetTypeOpt: discarded ? default : leftLValueType, UseLegacyWarnings(left, leftLValueType), trackMembers: true, AssignmentKind.Assignment);

Do we need Unsplit() after this call?


Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:8771 in ecfe673. [](commit_id = ecfe673, deletion_comment = False)

@cston
Copy link
Contributor

cston commented Feb 2, 2022

                        valueType = VisitOptionalImplicitConversion(rightPart, lvalueType, useLegacyWarnings: true, trackMembers: true, AssignmentKind.Assignment);

Unsplit()?


Refers to: src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs:9092 in ecfe673. [](commit_id = ecfe673, deletion_comment = False)

Co-authored-by: Charles Stoner <10732005+cston@users.noreply.github.com>
@RikkiGibson
Copy link
Member Author

I couldn't think of ways that the conditional state from the VisitOptionalImplicitConversion would be meaningfully used at either of those locations, so I added the Unsplit() call to be "conservative" about it.

@RikkiGibson RikkiGibson merged commit 29e1ec8 into dotnet:main Feb 2, 2022
@ghost ghost added this to the Next milestone Feb 2, 2022
@RikkiGibson RikkiGibson deleted the nullable-conv-annotations branch February 2, 2022 22:32
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P1 Feb 4, 2022
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.

Postconditions on user-defined conversion parameters are not respected Annotations do not work for user defined conversion operators

3 participants