-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Micha Reiser <micha@reiser.io>
- Loading branch information
1 parent
dc4cddb
commit ea18276
Showing
3 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
crates/ruff_python_parser/resources/inline/err/comprehension_missing_for_after_async.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(async) | ||
(x async x in iter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 114 additions & 0 deletions
114
...ython_parser/tests/snapshots/invalid_syntax@comprehension_missing_for_after_async.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
--- | ||
source: crates/ruff_python_parser/tests/fixtures.rs | ||
input_file: crates/ruff_python_parser/resources/inline/err/comprehension_missing_for_after_async.py | ||
--- | ||
## AST | ||
|
||
``` | ||
Module( | ||
ModModule { | ||
range: 0..28, | ||
body: [ | ||
Expr( | ||
StmtExpr { | ||
range: 0..7, | ||
value: Generator( | ||
ExprGenerator { | ||
range: 0..7, | ||
elt: Name( | ||
ExprName { | ||
range: 1..1, | ||
id: "", | ||
ctx: Invalid, | ||
}, | ||
), | ||
generators: [ | ||
Comprehension { | ||
range: 1..6, | ||
target: Name( | ||
ExprName { | ||
range: 6..6, | ||
id: "", | ||
ctx: Store, | ||
}, | ||
), | ||
iter: Name( | ||
ExprName { | ||
range: 6..6, | ||
id: "", | ||
ctx: Invalid, | ||
}, | ||
), | ||
ifs: [], | ||
is_async: true, | ||
}, | ||
], | ||
parenthesized: true, | ||
}, | ||
), | ||
}, | ||
), | ||
Expr( | ||
StmtExpr { | ||
range: 8..27, | ||
value: Generator( | ||
ExprGenerator { | ||
range: 8..27, | ||
elt: Name( | ||
ExprName { | ||
range: 9..10, | ||
id: "x", | ||
ctx: Load, | ||
}, | ||
), | ||
generators: [ | ||
Comprehension { | ||
range: 11..26, | ||
target: Name( | ||
ExprName { | ||
range: 17..18, | ||
id: "x", | ||
ctx: Store, | ||
}, | ||
), | ||
iter: Name( | ||
ExprName { | ||
range: 22..26, | ||
id: "iter", | ||
ctx: Load, | ||
}, | ||
), | ||
ifs: [], | ||
is_async: true, | ||
}, | ||
], | ||
parenthesized: true, | ||
}, | ||
), | ||
}, | ||
), | ||
], | ||
}, | ||
) | ||
``` | ||
## Errors | ||
|
||
| | ||
1 | (async) | ||
| ^^^^^ Syntax Error: Expected an expression | ||
2 | (x async x in iter) | ||
| | ||
|
||
|
||
| | ||
1 | (async) | ||
| ^ Syntax Error: Expected 'for', found ')' | ||
2 | (x async x in iter) | ||
| | ||
|
||
|
||
| | ||
1 | (async) | ||
2 | (x async x in iter) | ||
| ^ Syntax Error: Expected 'for', found name | ||
| |