mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 08:30:30 +00:00
[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:
parent
9db63fc58c
commit
d5410ef9fe
6 changed files with 70 additions and 44 deletions
|
@ -126,8 +126,6 @@ pub enum ParseErrorType {
|
|||
/// A default value was found for a `*` or `**` parameter.
|
||||
VarParameterWithDefault,
|
||||
|
||||
/// A duplicate parameter was found in a function definition or lambda expression.
|
||||
DuplicateParameter(String),
|
||||
/// A keyword argument was repeated.
|
||||
DuplicateKeywordArgumentError(String),
|
||||
|
||||
|
@ -285,9 +283,6 @@ impl std::fmt::Display for ParseErrorType {
|
|||
f.write_str("Invalid augmented assignment target")
|
||||
}
|
||||
ParseErrorType::InvalidDeleteTarget => f.write_str("Invalid delete target"),
|
||||
ParseErrorType::DuplicateParameter(arg_name) => {
|
||||
write!(f, "Duplicate parameter {arg_name:?}")
|
||||
}
|
||||
ParseErrorType::DuplicateKeywordArgumentError(arg_name) => {
|
||||
write!(f, "Duplicate keyword argument {arg_name:?}")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue