Skip to content

Can/should is operator update null-state in false case? #30297

@jcouv

Description

@jcouv
string? s = null;
if (!(s is object)) { s.ToString(); /* could warn? */ }
if (!(s is string)) { s.ToString(); /* could warn? */ }

There are variants of this scenario with string! and string~. The question is whether we should learn in both branches, or whether we should treat one branch as unreachable.

Relates to #30283

Metadata

Metadata

Assignees

No one assigned

    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