Skip to content

is operator affects null-state of the operand #29318

@jcouv

Description

@jcouv
        interface IBase { }
        interface IDerived : IBase { }
        void M(IBase x)
        {
            x.ToString();
            if (x is IDerived)
            {
                x.ToString();                
            }
            else
            {
                x.ToString(); // unexpected warning
            }
            x.ToString(); // unexpected warning
        }

image

FYI @cston

Found in dogfood

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