Expand NamedExpr range to include full range of parenthesized value (#6632)
## Summary
Given:
```python
if (
x
:=
( # 4
y # 5
) # 6
):
pass
```
It turns out the parser ended the range of the `NamedExpr` at the end of
`y`, rather than the end of the parenthesis that encloses `y`. This just
seems like a bug -- the range should be from the start of the name on
the left, to the end of the parenthesized node on the right.
## Test Plan
`cargo test`
This commit is contained in:
@@ -603,6 +603,13 @@ def func[T, U: str, *Ts, **P]():
|
||||
insta::assert_debug_snapshot!(parse_ast);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_named_expression() {
|
||||
let source = "(x := ( y * z ))";
|
||||
let parse_ast = parse_expression(source, "<test>").unwrap();
|
||||
insta::assert_debug_snapshot!(parse_ast);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_statement() {
|
||||
let source = "\
|
||||
|
||||
Reference in New Issue
Block a user