11[case testTypeVarDefaultsBasic]
2- import builtins
32from typing import Generic, TypeVar, ParamSpec, Callable, Tuple, List
43from typing_extensions import TypeVarTuple, Unpack
54
@@ -10,7 +9,7 @@ Ts1 = TypeVarTuple("Ts1", default=Unpack[Tuple[int, str]])
109def f1(a: T1) -> List[T1]: ...
1110reveal_type(f1) # N: Revealed type is "def [T1 = builtins.int] (a: T1`-1 = builtins.int) -> builtins.list[T1`-1 = builtins.int]"
1211
13- def f2(a: Callable[P1, None] ) -> Callable[P1, None]: ...
12+ def f2(a: Callable[P1, None]) -> Callable[P1, None]: ...
1413reveal_type(f2) # N: Revealed type is "def [P1 = [builtins.int, builtins.str]] (a: def (*P1.args, **P1.kwargs)) -> def (*P1.args, **P1.kwargs)"
1514
1615def f3(a: Tuple[Unpack[Ts1]]) -> Tuple[Unpack[Ts1]]: ...
@@ -68,7 +67,7 @@ P2 = ParamSpec("P2", default=2) # E: The default argument to ParamSpec must be
6867P3 = ParamSpec("P3", default=(2, int)) # E: The default argument to ParamSpec must be a list expression, ellipsis, or a ParamSpec
6968P4 = ParamSpec("P4", default=[2, int]) # E: Argument 0 of ParamSpec default must be a type
7069
71- Ts1 = TypeVarTuple("Ts1", default=2) # E: The default argument to TypeVarTuple must be an Unpacked tuple
70+ Ts1 = TypeVarTuple("Ts1", default=2) # E: The default argument to TypeVarTuple must be an Unpacked tuple
7271Ts2 = TypeVarTuple("Ts2", default=int) # E: The default argument to TypeVarTuple must be an Unpacked tuple
7372Ts3 = TypeVarTuple("Ts3", default=Tuple[int]) # E: The default argument to TypeVarTuple must be an Unpacked tuple
7473[builtins fixtures/tuple.pyi]
@@ -181,8 +180,8 @@ reveal_type(func_b1(callback1)) # N: Revealed type is "def (x: builtins.str)"
181180reveal_type(func_b1(2)) # N: Revealed type is "def (builtins.int, builtins.str)"
182181
183182def func_c1(x: Union[int, Callable[[Unpack[Ts1]], None]]) -> Tuple[Unpack[Ts1]]: ...
184- # reveal_type(func_c1(callback1)) # Revealed type is "builtins.tuple [str]" # TODO
185- # reveal_type(func_c1(2)) # Revealed type is "builtins.tuple [builtins.int, builtins.str]" # TODO
183+ # reveal_type(func_c1(callback1)) # Revealed type is "Tuple [str]" # TODO
184+ reveal_type(func_c1(2)) # N: Revealed type is "Tuple [builtins.int, builtins.str]"
186185[builtins fixtures/tuple.pyi]
187186
188187[case testTypeVarDefaultsClass1]
0 commit comments