From LDM 2/20/2019 and 3/6/2019 (adjusted {} and derived is Base):
"Pure" tests should set the null-state of x in both branches:
x == null
x != null
(Type)x == null
(Type)x != null
x is null
x?.F
x?[i]
x ?? y
bool [EqualsBehavior]MyEquals(object other)
Note: pure tests 1 through 5 (included) are implemented or verified in #33929
"Not pure" tests should only set the null-state of x in one branch:
x is Y // where Y is not a base of X
x is Y y
x is Y _
x is C { Property = 3 }
TryGetValue([NotNullWhenTrue])
[NotNulllWhenFalse] string.IsNullOrEmpty(s)
derived is Base
x is { }
switch expressions and statements should also use this notion of "pure test" (LDM 3/6/2019).
When closing this issue, we should also close #33526 (and remove references to both issues from code)
From LDM 2/20/2019 and 3/6/2019 (adjusted
{}andderived is Base):"Pure" tests should set the null-state of
xin both branches:x == nullx != null(Type)x == null(Type)x != nullx is nullx?.Fx?[i]x ?? ybool [EqualsBehavior]MyEquals(object other)Note: pure tests 1 through 5 (included) are implemented or verified in #33929
"Not pure" tests should only set the null-state of
xin one branch:x is Y // where Y is not a base of Xx is Y yx is Y _x is C { Property = 3 }TryGetValue([NotNullWhenTrue])[NotNulllWhenFalse] string.IsNullOrEmpty(s)derived is Basex is { }switchexpressions and statements should also use this notion of "pure test" (LDM 3/6/2019).When closing this issue, we should also close #33526 (and remove references to both issues from code)