Skip to content

Commit 0585337

Browse files
committed
update error message
1 parent 886db18 commit 0585337

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

crates/ruff_python_parser/src/error.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,7 @@ impl Display for UnsupportedSyntaxError {
544544
UnsupportedSyntaxErrorKind::Match => "Cannot use `match` statement",
545545
UnsupportedSyntaxErrorKind::Walrus => "Cannot use named assignment expression (`:=`)",
546546
UnsupportedSyntaxErrorKind::ExceptStar => "Cannot use `except*`",
547-
UnsupportedSyntaxErrorKind::RelaxedDecorator => {
548-
"Cannot use named expression in decorator"
549-
}
547+
UnsupportedSyntaxErrorKind::RelaxedDecorator => "Unsupported expression in decorators",
550548
UnsupportedSyntaxErrorKind::PositionalOnlyParameter => {
551549
"Cannot use positional-only parameter separator"
552550
}

crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_expression_py38.py.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ Module(
9696
|
9797
1 | # parse_options: { "target-version": "3.8" }
9898
2 | @buttons[0].clicked.connect
99-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Syntax Error: Cannot use named expression in decorator on Python 3.8 (syntax was added in Python 3.9)
99+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ Syntax Error: Unsupported expression in decorators on Python 3.8 (syntax was added in Python 3.9)
100100
3 | def spam(): ...
101101
|

crates/ruff_python_parser/tests/snapshots/invalid_syntax@decorator_named_expression_py37.py.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ Module(
128128
|
129129
1 | # parse_options: { "target-version": "3.7" }
130130
2 | @(x := lambda x: x)(foo)
131-
| ^^^^^^^^^^^^^^^^^^^^^^^ Syntax Error: Cannot use named expression in decorator on Python 3.7 (syntax was added in Python 3.9)
131+
| ^^^^^^^^^^^^^^^^^^^^^^^ Syntax Error: Unsupported expression in decorators on Python 3.7 (syntax was added in Python 3.9)
132132
3 | def bar(): ...
133133
|

0 commit comments

Comments
 (0)