Skip to content

Not inferring nullability of non-nullable value compared to null #32703

@cston

Description

@cston

Should report warnings for s.Length and c.F.ToString():

#pragma warning disable 0649
#pragma warning disable 8618

class C
{
    internal object F;
}

class Program
{
    static void F(string s, C c)
    {
        if (s == null)
            _ = s.Length;

        if (c.F != null) return;
        c.F.ToString();
    }
}

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions