Currently reporting a warning for second s.ToString();
class Program
{
static void F(string? s)
{
if (s?.Length != null)
s.ToString();
if (s?.Length == 1)
s.ToString(); // warning: may be null
}
}
[jcouv update:] relates to #27928 (nullability analysis of ==). If we learn that x == 1 means that x is non-null, then the above behavior should fall out.
Currently reporting a warning for second
s.ToString();[jcouv update:] relates to #27928 (nullability analysis of
==). If we learn thatx == 1means thatxis non-null, then the above behavior should fall out.