Add support for PEP 696 syntax (#11120)

This commit is contained in:
Jelle Zijlstra 2024-04-26 00:47:29 -07:00 committed by GitHub
parent 45725d3275
commit cd3e319538
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
49 changed files with 4338 additions and 669 deletions

View file

@ -29,9 +29,15 @@ class Test(A, B):
# TypeVar
class Test[T](): ...
# TypeVar with default
class Test[T = str](): ...
# TypeVar with bound
class Test[T: str](): ...
# TypeVar with bound and default
class Test[T: int | str = int](): ...
# TypeVar with tuple bound
class Test[T: (str, bytes)](): ...
@ -44,9 +50,18 @@ class Test[T, U,](): ...
# TypeVarTuple
class Test[*Ts](): ...
# TypeVarTuple with default
class Test[*Ts = Unpack[tuple[int, str]]](): ...
# TypeVarTuple with starred default
class Test[*Ts = *tuple[int, str]](): ...
# ParamSpec
class Test[**P](): ...
# ParamSpec with default
class Test[**P = [int, str]](): ...
# Mixed types
class Test[X, Y: str, *U, **P]():
pass