@@ -448,11 +448,11 @@ def foo2(*args: Unpack[Tuple[bool, Unpack[Tuple[int, str]], bool]]) -> None:
448448
449449# It is hard to normalize callable types in definition, because there is deep relation between `FuncDef.type`
450450# and `FuncDef.arguments`, therefore various typeops need to be sure to normalize Callable types before using them.
451- reveal_type(foo2) # N: Revealed type is "def (*args: Unpack[Tuple[builtins.bool, builtins.int, builtins.str, builtins.bool]])"
451+ reveal_type(foo2) # N: Revealed type is "def (*Unpack[Tuple[builtins.bool, builtins.int, builtins.str, builtins.bool]])"
452452
453453class C:
454454 def foo2(self, *args: Unpack[Tuple[bool, Unpack[Tuple[int, str]], bool]]) -> None: ...
455- reveal_type(C().foo2) # N: Revealed type is "def (*args: Unpack[Tuple[builtins.bool, builtins.int, builtins.str, builtins.bool]])"
455+ reveal_type(C().foo2) # N: Revealed type is "def (*Unpack[Tuple[builtins.bool, builtins.int, builtins.str, builtins.bool]])"
456456[builtins fixtures/tuple.pyi]
457457
458458[case testTypeVarTuplePep646TypeVarStarArgsVariableLengthTuple]
@@ -2015,7 +2015,7 @@ from typing_extensions import TypeVarTuple, Unpack
20152015Ts = TypeVarTuple("Ts")
20162016class B(Generic[Unpack[Ts]]):
20172017 def __init__(self, x: Tuple[Unpack[Ts]], *args: Unpack[Ts]) -> None: ...
2018- reveal_type(B) # N: Revealed type is "def [Ts] (x: Tuple[Unpack[Ts`1]], *args: Unpack[Ts`1]) -> __main__.B[Unpack[Ts`1]]"
2018+ reveal_type(B) # N: Revealed type is "def [Ts] (x: Tuple[Unpack[Ts`1]], *Unpack[Ts`1]) -> __main__.B[Unpack[Ts`1]]"
20192019
20202020T = TypeVar("T")
20212021S = TypeVar("S")
@@ -2140,7 +2140,7 @@ get_items(b) # E: Argument 1 to "get_items" has incompatible type "Bad"; expect
21402140match(b) # E: Argument 1 to "match" has incompatible type "Bad"; expected "PC[Unpack[Tuple[Never, ...]]]" \
21412141 # N: Following member(s) of "Bad" have conflicts: \
21422142 # N: Expected: \
2143- # N: def meth(self, *args: Never) -> None \
2143+ # N: def meth(self, *Never) -> None \
21442144 # N: Got: \
21452145 # N: def meth(self, *, named: int) -> None
21462146[builtins fixtures/tuple.pyi]
@@ -2178,14 +2178,14 @@ class Keywords(TypedDict):
21782178Ints = Tuple[int, ...]
21792179
21802180def f(*args: Unpack[Ints], other: str = "no", **kwargs: Unpack[Keywords]) -> None: ...
2181- reveal_type(f) # N: Revealed type is "def (*args: builtins.int, other: builtins.str =, **kwargs: Unpack[TypedDict('__main__.Keywords', {'a': builtins.str, 'b': builtins.str})])"
2181+ reveal_type(f) # N: Revealed type is "def (*builtins.int, other: builtins.str =, **kwargs: Unpack[TypedDict('__main__.Keywords', {'a': builtins.str, 'b': builtins.str})])"
21822182f(1, 2, a="a", b="b") # OK
21832183f(1, 2, 3) # E: Missing named argument "a" for "f" \
21842184 # E: Missing named argument "b" for "f"
21852185
21862186Ts = TypeVarTuple("Ts")
21872187def g(*args: Unpack[Ts], other: str = "no", **kwargs: Unpack[Keywords]) -> None: ...
2188- reveal_type(g) # N: Revealed type is "def [Ts] (*args: Unpack[Ts`-1], other: builtins.str =, **kwargs: Unpack[TypedDict('__main__.Keywords', {'a': builtins.str, 'b': builtins.str})])"
2188+ reveal_type(g) # N: Revealed type is "def [Ts] (*Unpack[Ts`-1], other: builtins.str =, **kwargs: Unpack[TypedDict('__main__.Keywords', {'a': builtins.str, 'b': builtins.str})])"
21892189g(1, 2, a="a", b="b") # OK
21902190g(1, 2, 3) # E: Missing named argument "a" for "g" \
21912191 # E: Missing named argument "b" for "g"
@@ -2194,15 +2194,15 @@ def bad(
21942194 *args: Unpack[Keywords], # E: "Keywords" cannot be unpacked (must be tuple or TypeVarTuple)
21952195 **kwargs: Unpack[Ints], # E: Unpack item in ** argument must be a TypedDict
21962196) -> None: ...
2197- reveal_type(bad) # N: Revealed type is "def (*args: Any, **kwargs: Any)"
2197+ reveal_type(bad) # N: Revealed type is "def (*Any, **kwargs: Any)"
21982198
21992199def bad2(
22002200 one: int,
22012201 *args: Unpack[Keywords], # E: "Keywords" cannot be unpacked (must be tuple or TypeVarTuple)
22022202 other: str = "no",
22032203 **kwargs: Unpack[Ints], # E: Unpack item in ** argument must be a TypedDict
22042204) -> None: ...
2205- reveal_type(bad2) # N: Revealed type is "def (one: builtins.int, *args: Any, other: builtins.str =, **kwargs: Any)"
2205+ reveal_type(bad2) # N: Revealed type is "def (one: builtins.int, *Any, other: builtins.str =, **kwargs: Any)"
22062206[builtins fixtures/dict.pyi]
22072207[typing fixtures/typing-typeddict.pyi]
22082208
@@ -2429,7 +2429,7 @@ Ts = TypeVarTuple("Ts")
24292429@cm
24302430def test(*args: Unpack[Ts]) -> Tuple[Unpack[Ts]]: ...
24312431
2432- reveal_type(test) # N: Revealed type is "def [Ts] (*args: Unpack[Ts`-1]) -> __main__.CM[Tuple[Unpack[Ts`-1]]]"
2432+ reveal_type(test) # N: Revealed type is "def [Ts] (*Unpack[Ts`-1]) -> __main__.CM[Tuple[Unpack[Ts`-1]]]"
24332433reveal_type(test(1, 2, 3)) # N: Revealed type is "__main__.CM[Tuple[Literal[1]?, Literal[2]?, Literal[3]?]]"
24342434[builtins fixtures/tuple.pyi]
24352435
@@ -2447,7 +2447,7 @@ Ts = TypeVarTuple("Ts")
24472447@cm # E: Argument 1 to "cm" has incompatible type "Callable[[VarArg(Unpack[Ts])], Tuple[Unpack[Ts]]]"; expected "Callable[[VarArg(Never)], List[Never]]"
24482448def test(*args: Unpack[Ts]) -> Tuple[Unpack[Ts]]: ...
24492449
2450- reveal_type(test) # N: Revealed type is "def (*args: Never) -> __main__.CM[Never]"
2450+ reveal_type(test) # N: Revealed type is "def (*Never) -> __main__.CM[Never]"
24512451[builtins fixtures/tuple.pyi]
24522452
24532453[case testTypeVarTupleAgainstParamSpecActualPrefix]
@@ -2465,7 +2465,7 @@ Ts = TypeVarTuple("Ts")
24652465@cm
24662466def test(x: T, *args: Unpack[Ts]) -> Tuple[T, Unpack[Ts]]: ...
24672467
2468- reveal_type(test) # N: Revealed type is "def [T, Ts] (builtins.list[T`2], *args: Unpack[Ts`-2]) -> __main__.CM[Tuple[T`2, Unpack[Ts`-2]]]"
2468+ reveal_type(test) # N: Revealed type is "def [T, Ts] (builtins.list[T`2], *Unpack[Ts`-2]) -> __main__.CM[Tuple[T`2, Unpack[Ts`-2]]]"
24692469[builtins fixtures/tuple.pyi]
24702470
24712471[case testMixingTypeVarTupleAndParamSpec]
@@ -2585,7 +2585,7 @@ class C(Generic[Unpack[Ts]]):
25852585 def foo(self, *args: Unpack[Ts]) -> None: ...
25862586
25872587c: C[Unpack[tuple[int, ...]]]
2588- reveal_type(c.foo) # N: Revealed type is "def (*args: builtins.int)"
2588+ reveal_type(c.foo) # N: Revealed type is "def (*builtins.int)"
25892589[builtins fixtures/tuple.pyi]
25902590
25912591[case testTypeVarTupleJoinInstanceTypeVar]
0 commit comments