@@ -13,6 +13,8 @@ type MyInt2 = int
1313
1414def h(x: MyInt2) -> MyInt2:
1515 return reveal_type(x) # N: Revealed type is "builtins.int"
16+ [builtins fixtures/tuple.pyi]
17+ [typing fixtures/typing-full.pyi]
1618
1719[case testPEP695Class]
1820class MyGen[T]:
@@ -49,6 +51,7 @@ def func1[T: int](x: T) -> T: ...
4951def func2[**P](x: Callable[P, int]) -> Callable[P, str]: ...
5052def func3[*Ts](x: tuple[*Ts]) -> tuple[int, *Ts]: ...
5153[builtins fixtures/tuple.pyi]
54+ [typing fixtures/typing-full.pyi]
5255
5356[case testPEP695TypeAliasType]
5457from typing import Callable, TypeAliasType, TypeVar, TypeVarTuple
@@ -603,6 +606,7 @@ type A4 = int | str
603606a4: A4
604607reveal_type(a4) # N: Revealed type is "Union[builtins.int, builtins.str]"
605608[builtins fixtures/type.pyi]
609+ [typing fixtures/typing-full.pyi]
606610
607611[case testPEP695TypeAliasNotValidAsBaseClass]
608612from typing import TypeAlias
@@ -635,7 +639,8 @@ class Good5(B3): pass
635639[file m.py]
636640type A1 = str
637641type A2[T] = list[T]
638- [typing fixtures/typing-medium.pyi]
642+ [builtins fixtures/tuple.pyi]
643+ [typing fixtures/typing-full.pyi]
639644
640645[case testPEP695TypeAliasWithUnusedTypeParams]
641646type A[T] = int
@@ -649,6 +654,8 @@ a: A[int]
649654reveal_type(a) # N: Revealed type is "__main__.C[builtins.int]"
650655
651656class C[T]: pass
657+ [builtins fixtures/tuple.pyi]
658+ [typing fixtures/typing-full.pyi]
652659
653660[case testPEP695TypeAliasForwardReference2]
654661type X = C
@@ -670,6 +677,8 @@ reveal_type(a) # N: Revealed type is "__main__.C[__main__.D]"
670677
671678class C[T]: pass
672679class D: pass
680+ [builtins fixtures/tuple.pyi]
681+ [typing fixtures/typing-full.pyi]
673682
674683[case testPEP695TypeAliasForwardReference4]
675684type A = C
@@ -692,6 +701,8 @@ c: C[str]
692701reveal_type(a) # N: Revealed type is "builtins.str"
693702reveal_type(b) # N: Revealed type is "__main__.C[builtins.int]"
694703reveal_type(c) # N: Revealed type is "__main__.C[builtins.str]"
704+ [builtins fixtures/tuple.pyi]
705+ [typing fixtures/typing-full.pyi]
695706
696707[case testPEP695TypeAliasWithUndefineName]
697708type A[T] = XXX # E: Name "XXX" is not defined
@@ -707,10 +718,13 @@ type B = int + str # E: Invalid type alias: expression is not a valid type
707718b: B
708719reveal_type(b) # N: Revealed type is "Any"
709720[builtins fixtures/type.pyi]
721+ [typing fixtures/typing-full.pyi]
710722
711723[case testPEP695TypeAliasBoundForwardReference]
712724type B[T: Foo] = list[T]
713725class Foo: pass
726+ [builtins fixtures/tuple.pyi]
727+ [typing fixtures/typing-full.pyi]
714728
715729[case testPEP695UpperBound]
716730class D:
@@ -777,6 +791,8 @@ reveal_type(a) # N: Revealed type is "__main__.C[__main__.D[__main__.X]]"
777791reveal_type(b) # N: Revealed type is "__main__.C[__main__.E[__main__.X]]"
778792
779793c: C[D[int]] # E: Type argument "D[int]" of "C" must be a subtype of "D[X]"
794+ [builtins fixtures/tuple.pyi]
795+ [typing fixtures/typing-full.pyi]
780796
781797[case testPEP695UpperBoundForwardReference4]
782798def f[T: D](a: T) -> T:
@@ -935,6 +951,7 @@ type C[*Ts] = tuple[*Ts, int]
935951a: C[str, None]
936952reveal_type(a) # N: Revealed type is "Tuple[builtins.str, None, builtins.int]"
937953[builtins fixtures/tuple.pyi]
954+ [typing fixtures/typing-full.pyi]
938955
939956[case testPEP695IncrementalFunction]
940957import a
@@ -1036,6 +1053,7 @@ class Foo[T]: pass
10361053type B[T] = Foo[T]
10371054
10381055[builtins fixtures/tuple.pyi]
1056+ [typing fixtures/typing-full.pyi]
10391057[out2]
10401058tmp/a.py:3: note: Revealed type is "builtins.str"
10411059tmp/a.py:5: note: Revealed type is "b.Foo[builtins.int]"
@@ -1249,6 +1267,7 @@ type B[T] = C[T] | list[B[T]]
12491267b: B[int]
12501268reveal_type(b) # N: Revealed type is "Union[__main__.C[builtins.int], builtins.list[...]]"
12511269[builtins fixtures/type.pyi]
1270+ [typing fixtures/typing-full.pyi]
12521271
12531272[case testPEP695BadRecursiveTypeAlias]
12541273type A = A # E: Cannot resolve name "A" (possible cyclic definition)
@@ -1277,6 +1296,7 @@ f(C[C[str]]())
12771296f(1) # E: Argument 1 to "f" has incompatible type "int"; expected "A"
12781297f(C[int]()) # E: Argument 1 to "f" has incompatible type "C[int]"; expected "A"
12791298[builtins fixtures/isinstance.pyi]
1299+ [typing fixtures/typing-full.pyi]
12801300
12811301[case testPEP695InvalidGenericOrProtocolBaseClass]
12821302from typing import Generic, Protocol, TypeVar
@@ -1579,6 +1599,8 @@ else:
15791599x: T # E: Name "T" is not defined
15801600a: A[int]
15811601reveal_type(a) # N: Revealed type is "builtins.list[builtins.int]"
1602+ [builtins fixtures/tuple.pyi]
1603+ [typing fixtures/typing-full.pyi]
15821604
15831605[case testPEP695UndefinedNameInAnnotation]
15841606def f[T](x: foobar, y: T) -> T: ... # E: Name "foobar" is not defined
@@ -1592,6 +1614,8 @@ reveal_type(a) # N: Revealed type is "builtins.list[builtins.int]"
15921614type B[T: (int,)] = list[T] # E: Type variable must have at least two constrained types
15931615b: B[str]
15941616reveal_type(b) # N: Revealed type is "builtins.list[builtins.str]"
1617+ [builtins fixtures/tuple.pyi]
1618+ [typing fixtures/typing-full.pyi]
15951619
15961620[case testPEP695UsingTypeVariableInOwnBoundOrConstraint]
15971621type A[T: list[T]] = str # E: Name "T" is not defined
@@ -1611,6 +1635,8 @@ a: A
16111635reveal_type(a) # N: Revealed type is "builtins.list[Any]"
16121636b: B
16131637reveal_type(b) # N: Revealed type is "Any"
1638+ [builtins fixtures/tuple.pyi]
1639+ [typing fixtures/typing-full.pyi]
16141640
16151641[case testPEP695GenericNamedTuple]
16161642from typing import NamedTuple
@@ -1795,6 +1821,7 @@ reveal_type(y) # N: Revealed type is "Union[builtins.int, builtins.str]"
17951821reveal_type(z) # N: Revealed type is "builtins.int"
17961822reveal_type(zz) # N: Revealed type is "builtins.str"
17971823[builtins fixtures/tuple.pyi]
1824+ [typing fixtures/typing-full.pyi]
17981825
17991826[case testPEP695NestedGenericClass1]
18001827class C[T]:
@@ -1972,3 +1999,19 @@ class D:
19721999 class G[Q]:
19732000 def g(self, x: Q): ...
19742001 d: G[str]
2002+
2003+ [case testTypeAliasNormalization]
2004+ from collections.abc import Callable
2005+ from typing import Unpack
2006+ from typing_extensions import TypeAlias
2007+
2008+ type RK_function_args = tuple[float, int]
2009+ type RK_functionBIS = Callable[[Unpack[RK_function_args], int], int]
2010+
2011+ def ff(a: float, b: int, c: int) -> int:
2012+ return 2
2013+
2014+ bis: RK_functionBIS = ff
2015+ res: int = bis(1.0, 2, 3)
2016+ [builtins fixtures/tuple.pyi]
2017+ [typing fixtures/typing-full.pyi]
0 commit comments