mirror of https://github.com/astral-sh/ruff
## Summary
This fix addresses panics related to invalid syntax like the following
where a `break` statement is used in a nested definition inside a
loop:
```py
while True:
def b():
x: int
break
```
closes #14342
## Test Plan
* New corpus regression tests.
* New unit test to make sure we handle nested while loops correctly.
This test is passing on `main`, but can easily fail if the
`is_inside_loop` state isn't properly saved/restored.
|
||
|---|---|---|
| .. | ||
| resources/test/corpus | ||
| src | ||
| tests | ||
| Cargo.toml | ||