mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-16 01:25:11 +00:00
Add support for PEP 696 syntax (#11120)
This commit is contained in:
parent
45725d3275
commit
cd3e319538
49 changed files with 4338 additions and 669 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue