`explicit-any-use`/`unknown-from-error` errors highlight the expression but the error message references the variable
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 62/100
Línea de trabajo
Search the Rust codebase for the diagnostic names explicit-any-use and unknown-from-error, then find where each diagnostic attaches its range and how the message gets the assigned variable name. Reproduce both snippets from the issue, or the sandbox, and compare the case where the result is not assigned. Done means the highlighted range and the message agree on whether the error is about the expression or the variable; add or update the relevant diagnostic test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
from typing import Any
def fn() -> Any: ...
def fn2() -> Unknown: ... # pyrefly: ignore[unknown-name]
foo = fn()
# ^^^^ error: The type of `foo` is an explicit `Any`
foo = fn2()
# ^^^^^ error: The type of `foo` is unknown because it comes from an error
the underlined code is the expression:
but the error messages refer to the variable foo.
this can be really confusing in some cases:
from typing import Any
def fn(foo: int) -> Any: ...
foo = fn(1)
# ^^^^^ error: The type of `foo` is an explicit `Any`
here it looks like the error is talking about the function parameter called foo
idk whether the best fix is to change the range where the errors are reported or just change the error messages. i'm leaning towards the former, because the error goes away when the result is not assigned to a variable, indicating that the error is actually about the variable rather than the expression.
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
-
pytorch tensor-shapes typechecking
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
good first issue typechecking
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
cargo b warning: unused dependency `zstd`Posiblemente ocupada @Narendersingh007 la tomó hace 4 días. Abiertogood first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
-
pydantic
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de facebook/pyrefly
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
eventflux-io/eventflux#203 ·
Los mantenedores suelen responder en 1 día
-
bug ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
userFRM/egui-charts#4068 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
trezor/trezor-firmware#8357 ·
Los mantenedores suelen responder en 2 días
-
fuzz-crash review-followup
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día