Skip to content

'is' operator should not affect StateWhenFalse#30283

Merged
jcouv merged 1 commit intodotnet:features/NullableReferenceTypesfrom
jcouv:is-pattern
Oct 3, 2018
Merged

'is' operator should not affect StateWhenFalse#30283
jcouv merged 1 commit intodotnet:features/NullableReferenceTypesfrom
jcouv:is-pattern

Conversation

@jcouv
Copy link
Copy Markdown
Member

@jcouv jcouv commented Oct 3, 2018

Fixes #29318

@jcouv jcouv added this to the 16.0 milestone Oct 3, 2018
@jcouv jcouv self-assigned this Oct 3, 2018
@jcouv jcouv requested a review from a team as a code owner October 3, 2018 05:27
@jcouv
Copy link
Copy Markdown
Member Author

jcouv commented Oct 3, 2018

@cston @333fred @AlekseyTs Tiny fix for the is operator for review. Thanks

{
Split();
this.StateWhenTrue[slot] = true;
this.StateWhenFalse[slot] = false;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this.StateWhenFalse[slot] = false; [](start = 16, length = 34)

Should we still do this for is object case?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Interesting. Feels like we could.

There's a whole class of such cases:

C x = null;
if (x is C) ...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Filed #30297 as follow-up, since a possibly missing warning is less urgent than fixing a false alarm warning.

Copy link
Copy Markdown
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 (iteration 1)

Split();
this.StateWhenTrue[slot] = true;
this.StateWhenFalse[slot] = false;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please add open issues for refining the analysis for cases such as these.

Copy link
Copy Markdown
Member

@gafter gafter left a comment

Choose a reason for hiding this comment

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

:shipit:

@jcouv jcouv merged commit 84d4a38 into dotnet:features/NullableReferenceTypes Oct 3, 2018
@jcouv jcouv deleted the is-pattern branch October 3, 2018 22:13
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.

3 participants