False positive in `dict.update` with variadic tuple keys
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start by running the four-line snippet in the issue (the d.update({(*prefix, 0, n): 1 ...}) case) against a local build to reproduce the no-matching-overload error. The payload does not name the source files, so locate the contextual inference for dict comprehensions and the handling of variadic tuple keys. Done means the snippet type-checks cleanly with no new errors in the existing test suite.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
Actual: no-matching-overload
The comprehension is inferred as dict[tuple[*tuple[int, ...], int, str], int], and dict[tuple[*tuple[int, ...], int, str], int] cannot be assigned to SupportsKeysAndGetItem[tuple[*tuple[int, ...], str], int] (this protocol is invariant in the key type).
Expected: Contextual inference should allow the comprehension to be typed as dict[Key, int]. ty 0.0.107 accepts this example.
type Key = tuple[*tuple[int, ...], str]
prefix: tuple[int, ...] = (1, 2, 3)
d: dict[Key, int] = {}
d.update({(*prefix, 0, n): 1 for n in ("train", "test")})
ERROR sandbox.py:4:9-58: No matching overload found for function `typing.MutableMapping.update` called with arguments: (dict[tuple[*tuple[int, ...], int, str], int]) [no-matching-overload]
Possible overloads:
(m: SupportsKeysAndGetItem[tuple[*tuple[int, ...], str], int], /) -> None [closest match]
(m: Iterable[tuple[tuple[*tuple[int, ...], str], int]], /) -> None
Argument `dict[tuple[*tuple[int, ...], int, str], int]` is not assignable to parameter `m` with type `SupportsKeysAndGetItem[tuple[*tuple[int, ...], str], int]` in function `typing.MutableMapping.update`
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