`del` in dead code should make variable local
Open
typechecking
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
Even though `del` is in unreachable code (`if False`), Python's compiler still marks the variable as local in the enclosing scope. Pyrefly should recognize this and report that `x` may be unbound.
```python
x = 1
def f():
print(x)
if False:
del x
```
**Sandbox:** [Pyrefly](https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXAAlHAhgOwCYCMD2AHgHQAOAnksiIcgLzICMAOpq9jGMmABQCUiVsmHJSAJwiYALj0J8hIiFwBi6KHBiDMIncg5RkhViAC%2BAGmroAxlIgA3GMugwqIDDgIkKpoA)
Contributor guide
Assessment
This issue has not been assessed yet.