Skip to content

Incorrect redundant-expr error for isinstance on constrained TypeVars #724

Open
@Loch64

Description

@Loch64

Describe the problem, ie expected/actual result (if it's not blatantly obvious)

def f[T: (int, str)](t: T):
    if isinstance(t, int):  # always true and always false
        ...

Gist to reproduce

https://mypy-play.net/?mypy=basedmypy-latest&python=3.12&gist=fd75669322cbcbe6bb7c20b985768813

Basedmypy version

basedmypy 2.5.0 (compiled: yes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions