mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-02 21:03:11 +00:00
The initial implementation of `infer_nonlocal` landed in https://github.com/astral-sh/ruff/pull/19112 fails to report an error for this example: ```py x = 1 def f(): # This is only a usage of `x`, not a definition. It shouldn't be # enough to make the `nonlocal` statement below allowed. print(x) def g(): nonlocal x ``` Fix this by continuing to walk enclosing scopes when the place we've found isn't bound, declared, or `nonlocal`. |
||
|---|---|---|
| .. | ||
| builder | ||
| use_def | ||
| ast_ids.rs | ||
| builder.rs | ||
| definition.rs | ||
| expression.rs | ||
| narrowing_constraints.rs | ||
| place.rs | ||
| predicate.rs | ||
| re_exports.rs | ||
| reachability_constraints.rs | ||
| use_def.rs | ||