Spurious `redundant-condition` when using `nonlocal`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 56/100
Línea de trabajo
Start by reproducing the warning from the linked Pyrefly sandbox and trace how the checker handles nonlocal assignments when deciding whether a condition is redundant. The issue names no source files or tests, so locate the relevant analysis code and add a regression test for the sandbox behavior. Done means the checker no longer reports if test as always false when do_thing mutates test through nonlocal.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
In the sandbox link I posted, Pyrefly warns that if test is redundant and will always evaluate to False. However, at runtime the else branch is taken. This appears to be due to the nonlocal test statement in do_thing not being recognized as mutating test.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
- Lenguaje dominante
- Rust
- Estrellas
- 7.2k
- Forks
- 578
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de facebook/pyrefly
-
Should `--preset=basic` show `reveal_type`?Posiblemente ocupada @MarcoGorelli la tomó hoy. Abiertoquansight
-
`for` loop over a subclass ignores its overridden `__iter__` and uses the base class's type argumentAbiertoquansight typechecking
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Hover does not show pathlib.Path.read_text docstringPosiblemente ocupada @1-DARK la tomó hoy. Abiertolanguage-server
-
`unbound-name` not reported after a for loop that contains `break`Posiblemente ocupada @1-DARK la tomó hoy. Abiertoscoping-control-flow
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
py3.15: error with sentinel + type qualifier (Final / ClassVar)Posiblemente ocupada @1-DARK la tomó hoy. Abiertopy3.15
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Todos los issues de facebook/pyrefly
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RustCrypto/utils#1597 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Non-`main` default branchesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
max-sixty/worktrunk#4727 · 7 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
carrick-sh/carrick#1859 ·
Los mantenedores suelen responder en 1 día