Skip to content

Learn from comparisons to non-constant, non-null values#35953

Merged
RikkiGibson merged 10 commits intodotnet:masterfrom
RikkiGibson:nullable-34942
Jun 4, 2019
Merged

Learn from comparisons to non-constant, non-null values#35953
RikkiGibson merged 10 commits intodotnet:masterfrom
RikkiGibson:nullable-34942

Conversation

@RikkiGibson
Copy link
Copy Markdown
Member

Resolves #34942

@RikkiGibson RikkiGibson requested a review from a team as a code owner May 24, 2019 22:08
@RikkiGibson
Copy link
Copy Markdown
Member Author

RikkiGibson commented May 24, 2019

        // learn from null constant

The non-null case changed to work for any expression determined to be non-null, not just constants. Does this need to change too? #Closed


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

@333fred
Copy link
Copy Markdown
Member

333fred commented May 29, 2019

Done review pass (commit 4)

@jcouv jcouv added this to the 16.2.P3 milestone May 29, 2019
@jcouv
Copy link
Copy Markdown
Member

jcouv commented May 30, 2019

        // learn from null constant

I don't think so. I think this can stay as-is.

There are two categories: (1) null constant (most confidence of nullness), and (2) maybe-null expressions (this is the most conservative inference). I don't think we can learn from a maybe-null expression, because it offers less confidence than a null constant (the null should definitely keep a maybe-null state) or a not-null expression (that inference is stronger, more conservative, than a maybe-null inference).


In reply to: 495802426 [](ancestors = 495802426)


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

Copy link
Copy Markdown
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.

Done with review pass (iteration 7)

@jcouv jcouv self-assigned this Jun 3, 2019
@RikkiGibson RikkiGibson requested review from 333fred and jcouv June 3, 2019 23:15
Copy link
Copy Markdown
Member

@333fred 333fred 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 8)

Copy link
Copy Markdown
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 for your patience!

@RikkiGibson RikkiGibson merged commit fa35880 into dotnet:master Jun 4, 2019
@RikkiGibson RikkiGibson deleted the nullable-34942 branch June 4, 2019 22:11
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.

Unexpected nullable warning due to null-conditional access

3 participants