Skip to content

Commit 3c0287e

Browse files
authored
Add test case for unpacked tuple in TypeAlias
1 parent a653243 commit 3c0287e

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test-data/unit/check-python310.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,6 +2389,18 @@ X = None | C
23892389
Y = None | D
23902390
[builtins fixtures/type.pyi]
23912391

2392+
[case testGenericTypeAliasArgOfTypeAliasIsUnpackedTuple]
2393+
from typing_extensions import TypeAlias
2394+
from typing import TypeVarTuple, Unpack
2395+
2396+
Ts = TypeVarTuple('Ts')
2397+
TA: TypeAlias = tuple[Unpack[Ts]]
2398+
2399+
# v1: TA[*list[int]] # E: Invalid syntax
2400+
2401+
v2: TA[Unpack[list[int]]] # E: "list[int]" cannot be unpacked (must be tuple or TypeVarTuple)
2402+
[builtins fixtures/tuple.pyi]
2403+
23922404
[case testMatchStatementWalrus]
23932405
class A:
23942406
a = 1

0 commit comments

Comments
 (0)