[v1.5 regression] Repeating a type guard condition causes the guard to be lost
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend-api-design, testing
Línea de trabajo
The report provides a Python example where repeating a TypeGuard condition with or loses the guard and causes two false positives. Start by reading the type checker’s handling of TypeGuard narrowing and boolean or expressions, then look for tests covering repeated guards. Done means the reported example preserves the narrowed type and no longer emits the false-positive diagnostics.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
Reported impact: 2 false-positive diagnostics in the attrs library
from typing import Any, TypeGuard
class C(Any):
pass
def has(cls: type) -> TypeGuard[type[C]]:
return hasattr(cls, "tag")
def f(t: type[object]) -> None:
if has(t) or has(t):
reveal_type(t)
t.tag # object has no class attribute `tag`
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
-
language-server
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
Attribute access after `if sys.platform != ...: return` is checked against the current platformAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Todos los issues de facebook/pyrefly
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
docs good first issue php
Dificultad 1/5 1-3 horas Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
bug(core): partial tool arguments drop existing string content during a split surrogate pairAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
0xPlaygrounds/rig#3176 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Publish memtop on crates.ioAbiertopackaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
SalomonAvila/memtop#23 ·
Los mantenedores suelen responder en 1 día