-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Milestone
Description
#nullable enable
public class Program
{
static void M(bool flag, string? x)
{
if (flag ? x?.Length == 2 : x?.Length == 3)
{
x.ToString(); // warns today, but perhaps shouldn't warn
}
}
}Note that if flag is changed to the constant true, the warning is not given.
The suggestion here is that if either conditional expression arm has a split state, we join the StateWhenTrue on each arm, and join the StateWhenFalse on each arm, and use the resulting split state as the resulting state of the conditional expression.
Reactions are currently unavailable