Closed as not planned
Description
Bug Report
not isinstance
check fails to narrow type for a TypeVar with a union bound.
To Reproduce
from typing import TypeVar
T = TypeVar("T", bound=int | str)
def foo(x: T) -> None:
if not isinstance(x, int):
reveal_type(x)
https://mypy-play.net/?mypy=latest&python=3.11&gist=2be94d37f0b12222d62a7f40e59fb152
Expected Behavior
Revealed type is "builtins.str".
Actual Behavior
Revealed type is "T`-1".
Your Environment
- Mypy version used: 1.4.1
- Python version used: 3.10.6