AnyStr.startswith(AnyStr) fails due to bytes not matching Buffer protocol
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- backend, testing-qa
Línea de trabajo
Start with the Python example in the issue and reproduce the .startswith() type error in Pyrefly, then trace how AnyStr bounds and the str and bytes method signatures are modeled. The issue names no source files or tests, so locate the relevant type-checker code and add a regression test for the example. Done means the call resolves for matching str and bytes arguments without the Buffer error.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Bug
from typing import *
def func(a: AnyStr, b: AnyStr) -> bool:
return a.startswith(b)
Python: 3.12
When creating a function as above, pyrefly fails to resolve the .startswith() call, claiming bytes doesn't satisfy Buffer.
This should resolve correctly, as AnyStr is bound to the same type for a and b, and str.startswith accepts strings and bytes.startswith accepts bytes
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
-
`errors` config docs don't make sensePosiblemente ocupada @i098 la tomó hace 1 día. Abiertodocumentation has-open-pr
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
-
narrowing typechecking
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Handle editable installs with .pth filesPosiblemente ocupada @connernilsen la tomó hace 2 días. Abiertoconfiguration
facebook/pyrefly#5457 · 1 comentario · 1 reacción · 2 asignados ·
-
narrowing typechecking
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
Todos los issues de facebook/pyrefly
Issues similares
-
security
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Waschndolos/open-clubmanager#185 ·
Los mantenedores suelen responder en 1 día
-
r-bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
servo/rust-smallvec#844 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
farion1231/cc-switch#9122 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
lbjlaq/Antigravity-Manager#3801 ·
Los mantenedores suelen responder en 1 día
-
LIMIT inputs are named MIN/MAX instead of the standard MN/MX, so LIMIT(MN := ...) does not resolveAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día