Closed as not planned
Closed as not planned
Description
from typing import TypeVar
class A:
a: int
class B:
b: int
T = TypeVar("T", A, B)
def foo(t: T):
t.b if isinstance(t, B) else t.a # error: "B" has no attribute "a"
if isinstance(t, B):
t.b # no error
else:
t.a
https://mypy-play.net/?mypy=0.961&python=3.10&gist=1646ac27c8249ac4752a973d9b2b54d4