@@ -1075,11 +1075,15 @@ x: TestType = 42
10751075y: TestType = 'a'
10761076z: TestType = object() # E: Incompatible types in assignment (expression has type "object", variable has type "Union[int, str]")
10771077
1078+ reveal_type(TestType) # N: Revealed type is "typing.TypeAliasType"
1079+ TestType() # E: "TypeAliasType" not callable
1080+
10781081class A:
10791082 ClassAlias = TypeAliasType("ClassAlias", int)
10801083xc: A.ClassAlias = 1
10811084yc: A.ClassAlias = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int")
10821085[builtins fixtures/tuple.pyi]
1086+ [typing fixtures/typing-full.pyi]
10831087
10841088[case testTypeAliasTypeInvalid]
10851089from typing_extensions import TypeAliasType
@@ -1094,6 +1098,7 @@ T3 = TypeAliasType("T3", -1) # E: Invalid type: try using Literal[-1] instead?
10941098t3: T3
10951099reveal_type(t3) # N: Revealed type is "Any"
10961100[builtins fixtures/tuple.pyi]
1101+ [typing fixtures/typing-full.pyi]
10971102
10981103[case testTypeAliasTypeGeneric]
10991104from typing import Callable, Dict, Generic, TypeVar, Tuple
@@ -1140,6 +1145,7 @@ ParamAlias2 = TypeAliasType("ParamAlias2", G[P, T], type_params=(P, T))
11401145xp: ParamAlias2[[int], str]
11411146reveal_type(xp) # N: Revealed type is "__main__.G[[builtins.int], builtins.str]"
11421147[builtins fixtures/dict.pyi]
1148+ [typing fixtures/typing-full.pyi]
11431149
11441150[case testTypeAliasTypeInvalidGeneric]
11451151from typing_extensions import TypeAliasType, TypeVarTuple, ParamSpec
@@ -1200,6 +1206,7 @@ class A(Generic[T]):
12001206x: A.Ta11 = {"a": 1}
12011207reveal_type(x) # N: Revealed type is "builtins.dict[builtins.str, Any]"
12021208[builtins fixtures/dict.pyi]
1209+ [typing fixtures/typing-full.pyi]
12031210
12041211[case testTypeAliasTypeNoUnpackInTypeParams311]
12051212# flags: --python-version 3.11
0 commit comments