mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 02:39:12 +00:00
[syntax-errors] Duplicate type parameter names (#16858)
Summary -- Detects duplicate type parameter names in function definitions, class definitions, and type alias statements. I also boxed the `type_params` field on `StmtTypeAlias` to make it easier to `match` with functions and classes. (That's the reason for the red-knot code owner review requests, sorry!) Test Plan -- New `ruff_python_syntax_errors` unit tests. Fixes #11119.
This commit is contained in:
parent
2baaedda6c
commit
e4f5fe8cf7
11 changed files with 1043 additions and 9 deletions
|
@ -0,0 +1,7 @@
|
|||
type Alias[T, T] = ...
|
||||
def f[T, T](t: T): ...
|
||||
class C[T, T]: ...
|
||||
type Alias[T, U: str, V: (str, bytes), *Ts, **P, T = default] = ...
|
||||
def f[T, T, T](): ... # two errors
|
||||
def f[T, *T](): ... # star is still duplicate
|
||||
def f[T, **T](): ... # as is double star
|
Loading…
Add table
Add a link
Reference in a new issue