**Bug Report** Mypy does not detect invalid usage within nested functions. This might be a duplicate of #8746 but I thought it's a different issue. **To Reproduce** ```python def a() -> None: val = 0 def b() -> None: val += 1 b() a() ``` **Expected Behavior** I'd like mypy to mark `val += 1` as an error, as the runtime does **Actual Behavior** Code is considered correct. **Your Environment** - Mypy version used: 0.982 - Mypy command-line flags: None - Python version used: 3.10.8