@@ -1423,6 +1423,45 @@ def f(x: Union[int, A], a: Type[A]) -> None:
14231423[builtins fixtures/isinstancelist.pyi]
14241424
14251425
1426+ [case testIsinstanceTypeArgs]
1427+ from typing import Iterable, TypeVar
1428+ x = 1
1429+ T = TypeVar('T')
1430+
1431+ isinstance(x, Iterable)
1432+ isinstance(x, Iterable[int]) # E: Parameterized generics cannot be used with class or instance checks
1433+ isinstance(x, Iterable[T]) # E: Parameterized generics cannot be used with class or instance checks
1434+ isinstance(x, (int, Iterable[int])) # E: Parameterized generics cannot be used with class or instance checks
1435+ isinstance(x, (int, (str, Iterable[int]))) # E: Parameterized generics cannot be used with class or instance checks
1436+
1437+ [builtins fixtures/isinstancelist.pyi]
1438+
1439+ [case testIsinstanceTypeArgsAliases]
1440+ from typing import Iterable, TypeVar
1441+ x = 1
1442+ T = TypeVar('T')
1443+ It = Iterable
1444+ It2 = Iterable[T]
1445+
1446+ isinstance(x, It[int]) # E: Parameterized generics cannot be used with class or instance checks
1447+ isinstance(x, It)
1448+ isinstance(x, It2[int]) # E: Parameterized generics cannot be used with class or instance checks
1449+ isinstance(x, It2) # E: Parameterized generics cannot be used with class or instance checks
1450+
1451+ [builtins fixtures/isinstance.pyi]
1452+
1453+
1454+ [case testIssubclassTypeArgs]
1455+ from typing import Iterable, TypeVar
1456+ x = int
1457+ T = TypeVar('T')
1458+ issubclass(x, Iterable)
1459+ issubclass(x, Iterable[int]) # E: Parameterized generics cannot be used with class or instance checks
1460+ issubclass(x, Iterable[T]) # E: Parameterized generics cannot be used with class or instance checks
1461+ issubclass(x, (int, Iterable[int])) # E: Parameterized generics cannot be used with class or instance checks
1462+
1463+ [builtins fixtures/isinstance.pyi]
1464+
14261465[case testIsinstanceAndNarrowTypeVariable]
14271466from typing import TypeVar
14281467
0 commit comments