| 1 |
[case testPEP696TypeAlias] |
| 2 |
type A[T = int] = C[T] |
| 3 |
[out] |
| 4 |
MypyFile:1( |
| 5 |
TypeAliasStmt:1( |
| 6 |
NameExpr(A) |
| 7 |
TypeParam( |
| 8 |
T |
| 9 |
Default( |
| 10 |
int?)) |
| 11 |
LambdaExpr:1( |
| 12 |
Block:-1( |
| 13 |
ReturnStmt:1( |
| 14 |
IndexExpr:1( |
| 15 |
NameExpr(C) |
| 16 |
NameExpr(T))))))) |
| 17 |
|
| 18 |
[case testPEP696GenericFunction] |
| 19 |
def f[T = int](): pass |
| 20 |
class C[T = int]: pass |
| 21 |
[out] |
| 22 |
MypyFile:1( |
| 23 |
FuncDef:1( |
| 24 |
f |
| 25 |
TypeParam( |
| 26 |
T |
| 27 |
Default( |
| 28 |
int?)) |
| 29 |
Block:1( |
| 30 |
PassStmt:1())) |
| 31 |
ClassDef:2( |
| 32 |
C |
| 33 |
TypeParam( |
| 34 |
T |
| 35 |
Default( |
| 36 |
int?)) |
| 37 |
PassStmt:2())) |
| 38 |
|
| 39 |
[case testPEP696ParamSpec] |
| 40 |
def f[**P = [int, str]](): pass |
| 41 |
class C[**P = [int, str]]: pass |
| 42 |
[out] |
| 43 |
[out] |
| 44 |
MypyFile:1( |
| 45 |
FuncDef:1( |
| 46 |
f |
| 47 |
TypeParam( |
| 48 |
**P |
| 49 |
Default( |
| 50 |
<TypeList int?, str?>)) |
| 51 |
Block:1( |
| 52 |
PassStmt:1())) |
| 53 |
ClassDef:2( |
| 54 |
C |
| 55 |
TypeParam( |
| 56 |
**P |
| 57 |
Default( |
| 58 |
<TypeList int?, str?>)) |
| 59 |
PassStmt:2())) |
| 60 |
|
| 61 |
[case testPEP696TypeVarTuple] |
| 62 |
def f[*Ts = *tuple[str, int]](): pass |
| 63 |
class C[*Ts = *tuple[str, int]]: pass |
| 64 |
[out] |
| 65 |
MypyFile:1( |
| 66 |
FuncDef:1( |
| 67 |
f |
| 68 |
TypeParam( |
| 69 |
*Ts |
| 70 |
Default( |
| 71 |
*tuple?[str?, int?])) |
| 72 |
Block:1( |
| 73 |
PassStmt:1())) |
| 74 |
ClassDef:2( |
| 75 |
C |
| 76 |
TypeParam( |
| 77 |
*Ts |
| 78 |
Default( |
| 79 |
*tuple?[str?, int?])) |
| 80 |
PassStmt:2())) |