Skip to content

Silence all diagnostics in unreachable code? #127

@sharkdp

Description

@sharkdp

Our current approach to silencing only a subset of diagnostics in unreachable sections of code has some issues. They are documented here. In short, we still emit false positives in some cases:

if False:
    x: int = 1
else:
    x: str = "a"

if False:
    # TODO We currently emit a false positive here:
    # error: [invalid-assignment] "Object of type `Literal["a"]` is not assignable to `int`"
    other: int = x
else:
    other: str = x

We should re-evaluate if it makes more sense to silence all diagnostics (possibly with a very limited set of exceptions, like reveal_type-messages) in unreachable sections.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions