-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Milestone
Description
There should be no warning in the following, since s is string only matches if s isn't null.
using System;
public class C
{
public void M(string? s)
{
if (s is string)
{
s.ToString(); // warning CS8602: Possible dereference of a null reference.
}
}
}Conversely, s is null should also inform nullability.
Also, s = null!.
(update: split the null-coalesing issue into separate issue: #26747)
Once fixed, please update this speclet section.
Reactions are currently unavailable