Skip to content

Infer nullability of receiver and member from ?. expression #25870

@cston

Description

@cston

There should be no warnings in the following. Currently, Possible dereference of a null reference is reported for c and c.F in c.F.ToString().

class C
{
    object? F;
    static void M(C? c)
    {
        if (c?.F != null)
            c.F.ToString();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions