@@ -41,7 +41,7 @@ T3 = TypeVar("T3", bound=List[Any], default=List[int])
4141T4 = TypeVar("T4", int, str, default=int)
4242T5 = TypeVar("T5", default=S0)
4343T6 = TypeVar("T6", bound=float, default=S1)
44- # T7 = TypeVar("T7", bound=List[Any], default=List[S0]) # TODO
44+ T7 = TypeVar("T7", bound=List[Any], default=List[S0])
4545
4646P1 = ParamSpec("P1", default=[])
4747P2 = ParamSpec("P2", default=...)
@@ -50,7 +50,7 @@ P4 = ParamSpec("P4", default=P0)
5050
5151Ts1 = TypeVarTuple("Ts1", default=Unpack[Tuple[int]])
5252Ts2 = TypeVarTuple("Ts2", default=Unpack[Tuple[int, ...]])
53- # Ts3 = TypeVarTuple("Ts3", default=Unpack[Ts0]) # TODO
53+ Ts3 = TypeVarTuple("Ts3", default=Unpack[Ts0])
5454[builtins fixtures/tuple.pyi]
5555
5656[case testTypeVarDefaultsInvalid]
@@ -180,7 +180,7 @@ reveal_type(func_b1(callback1)) # N: Revealed type is "def (x: builtins.str)"
180180reveal_type(func_b1(2)) # N: Revealed type is "def (builtins.int, builtins.str)"
181181
182182def func_c1(x: Union[int, Callable[[Unpack[Ts1]], None]]) -> Tuple[Unpack[Ts1]]: ...
183- # reveal_type(func_c1(callback1)) # Revealed type is "Tuple[ str]" # TODO
183+ reveal_type(func_c1(callback1)) # N: Revealed type is "tuple[builtins. str]"
184184reveal_type(func_c1(2)) # N: Revealed type is "tuple[builtins.int, builtins.str]"
185185[builtins fixtures/tuple.pyi]
186186
@@ -894,6 +894,20 @@ Alias: TypeAlias = "MyClass[T1, T2]"
894894class MyClass(Generic["T1", "T2"]): ...
895895[builtins fixtures/tuple.pyi]
896896
897+ [case testDefaultsApplicationInAliasNoCrashNested]
898+ from typing import Generic, TypeVar
899+ from typing_extensions import TypeAlias
900+
901+ T1 = TypeVar("T1")
902+ T2 = TypeVar("T2", default=list[T1])
903+
904+ Alias: TypeAlias = "MyClass[T1, T2]"
905+
906+ class MyClass(Generic["T1", "T2"]): ...
907+ x: Alias[int]
908+ reveal_type(x) # N: Revealed type is "__main__.MyClass[builtins.int, builtins.list[builtins.int]]"
909+ [builtins fixtures/tuple.pyi]
910+
897911[case testDefaultsMustBeInScope]
898912from typing import Generic, TypeVar
899913
0 commit comments