You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
x = y # E: Incompatible types in assignment (expression has type "Union[C1, C2, C3, C4, C5, <6 more items>, None]", variable has type "Union[C1, C2, C3, C4, C5, <6 more items>]") \
1347
1347
# N: Item in the first union not in the second: "None"
1348
+
1349
+
[case testTypeAliasWithOldUnionIsInstance]
1350
+
# flags: --python-version 3.10
1351
+
from typing import Union
1352
+
SimpleAlias = Union[int, str]
1353
+
1354
+
def foo(x: Union[int, str, tuple]):
1355
+
# TODO: fix the typeshed stub for isinstance
1356
+
if isinstance(x, SimpleAlias): # E: Argument 2 to "isinstance" has incompatible type "<typing special form>"; expected "type"
1357
+
reveal_type(x) # N: Revealed type is "Union[builtins.int, builtins.str, builtins.tuple[Any, ...]]"
1358
+
else:
1359
+
reveal_type(x) # N: Revealed type is "Union[builtins.int, builtins.str, builtins.tuple[Any, ...]]"
0 commit comments