mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[syntax-errors] Improve error message and range for pre-PEP-614 decorator syntax errors (#16581)
## Summary A small followup to https://github.com/astral-sh/ruff/pull/16386. We now tell the user exactly what it was about their decorator that constituted invalid syntax on Python <3.9, and the range now highlights the specific sub-expression that is invalid rather than highlighting the whole decorator ## Test Plan Inline snapshots are updated, and new ones are added.
This commit is contained in:
parent
4da6936ec4
commit
38bfda94ce
15 changed files with 574 additions and 19 deletions
|
@ -0,0 +1,4 @@
|
|||
# parse_options: { "target-version": "3.8" }
|
||||
async def foo():
|
||||
@await bar
|
||||
def baz(): ...
|
|
@ -0,0 +1,3 @@
|
|||
# parse_options: { "target-version": "3.8" }
|
||||
@{3: 3}
|
||||
def bar(): ...
|
|
@ -0,0 +1,3 @@
|
|||
# parse_options: { "target-version": "3.8" }
|
||||
@3.14
|
||||
def bar(): ...
|
|
@ -0,0 +1,3 @@
|
|||
# parse_options: { "target-version": "3.8" }
|
||||
@foo().bar()
|
||||
def baz(): ...
|
|
@ -0,0 +1,4 @@
|
|||
# parse_options: { "target-version": "3.9" }
|
||||
async def foo():
|
||||
@await bar
|
||||
def baz(): ...
|
Loading…
Add table
Add a link
Reference in a new issue