[syntax-errors] Make duplicate parameter names a semantic error (#17131)
Status -- This is a pretty minor change, but it was breaking a red-knot mdtest until #17463 landed. Now this should close #11934 as the last syntax error being tracked there! Summary -- Moves `Parser::validate_parameters` to `SemanticSyntaxChecker::duplicate_parameter_name`. Test Plan -- Existing tests, with `## Errors` replaced with `## Semantic Syntax Errors`.
This commit is contained in:
@@ -284,6 +284,16 @@ Module(
|
||||
```
|
||||
## Errors
|
||||
|
||||
|
|
||||
7 | lambda a, *a: 1
|
||||
8 |
|
||||
9 | lambda a, *, **a: 1
|
||||
| ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
|
|
||||
|
||||
|
||||
## Semantic Syntax Errors
|
||||
|
||||
|
|
||||
1 | lambda a, a: 1
|
||||
| ^ Syntax Error: Duplicate parameter "a"
|
||||
@@ -322,14 +332,6 @@ Module(
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
7 | lambda a, *a: 1
|
||||
8 |
|
||||
9 | lambda a, *, **a: 1
|
||||
| ^^^ Syntax Error: Expected one or more keyword parameter after '*' separator
|
||||
|
|
||||
|
||||
|
||||
|
|
||||
7 | lambda a, *a: 1
|
||||
8 |
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
---
|
||||
source: crates/ruff_python_parser/tests/fixtures.rs
|
||||
input_file: crates/ruff_python_parser/resources/inline/err/params_duplicate_names.py
|
||||
snapshot_kind: text
|
||||
---
|
||||
## AST
|
||||
|
||||
@@ -132,7 +131,7 @@ Module(
|
||||
},
|
||||
)
|
||||
```
|
||||
## Errors
|
||||
## Semantic Syntax Errors
|
||||
|
||||
|
|
||||
1 | def foo(a, a=10, *a, a, a: str, **a): ...
|
||||
|
||||
Reference in New Issue
Block a user