@@ -1243,31 +1243,22 @@ A = Union[int, List[A]]
12431243def func(x: A) -> int: ...
12441244[builtins fixtures/tuple.pyi]
12451245
1246- [case testAliasExplicitNoArgsBasic]
1247- from typing import Any, List, assert_type
1246+ [case testAliasNonGeneric]
12481247from typing_extensions import TypeAlias
1248+ class Foo: ...
12491249
1250- Implicit = List
1251- Explicit : TypeAlias = List
1250+ ImplicitFoo = Foo
1251+ ExplicitFoo : TypeAlias = Foo
12521252
1253- x1: Implicit[str]
1254- x2: Explicit[str] # E: Bad number of arguments for type alias, expected 0, given 1
1255- assert_type(x1, List[str])
1256- assert_type(x2, List[Any])
1257- [builtins fixtures/tuple.pyi]
1258-
1259- [case testAliasExplicitNoArgsGenericClass]
1260- # flags: --python-version 3.9
1261- from typing import Any, assert_type
1262- from typing_extensions import TypeAlias
1253+ x1: ImplicitFoo[str] # E: "Foo" expects no type arguments, but 1 given
1254+ x2: ExplicitFoo[str] # E: "Foo" expects no type arguments, but 1 given
12631255
1264- Implicit = list
1265- Explicit: TypeAlias = list
1256+ def is_foo(x: object):
1257+ if isinstance(x, ImplicitFoo):
1258+ pass
1259+ if isinstance(x, ExplicitFoo):
1260+ pass
12661261
1267- x1: Implicit[str]
1268- x2: Explicit[str] # E: Bad number of arguments for type alias, expected 0, given 1
1269- assert_type(x1, list[str])
1270- assert_type(x2, list[Any])
12711262[builtins fixtures/tuple.pyi]
12721263
12731264[case testAliasExplicitNoArgsTuple]
0 commit comments