Parser: an attribute or doc comment in front of a `{...` spread type changes how it is read
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- ocaml
- Área
- compilers
Línea de trabajo
Start by reading the lookahead in res_core.ml and the referenced context in #9115, which keeps the current behaviors. Reproduce the table with bsc -bs-no-builtin-ppx -only-parse -dparsetree to trace how prefixes affect {... classification. Done means prefixes no longer change the classification, both reported syntax errors are fixed, and the compatibility change has a changelog entry.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
A type body starting with {... can be a record spread or an object spread. Without a prefix, the parser reads it as a record unless a quoted field follows. With an attribute or a doc comment in front, it takes a different path, so the prefix changes what the declaration means or makes it a syntax error.
Checked on master at 85f31fbb15 with bsc -bs-no-builtin-ppx -only-parse -dparsetree:
type t = … |
no prefix | @attr |
/** d */ |
|---|---|---|---|
{...base, y: int} |
record | syntax error | record |
{...base} |
record | object type | record |
{...base, "y": int} |
object type | object type | syntax error |
The same holds after private, e.g. type t = private @attr {...base, y: int} is a syntax error.
Cause: after an attribute, the lookahead in res_core.ml treats {... as the start of a type expression (object type); after a doc comment, the record path is taken unconditionally. #9115 (for #9106) keeps both behaviours as they are, so nothing master accepts changes there.
Expected: the prefix doesn't matter, and {... is classified as without one. That fixes both syntax errors, but it also turns @attr {...base} from an object type into a record, which changes code that compiles today, so it needs a changelog entry.
🤖 Generated with Claude Code
- Lenguaje dominante
- OCaml
- Estrellas
- 7.5k
- Forks
- 484
- Merge medio
- 21 h 9 min
- PR fusionados (30 d)
- 255
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- 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 rescript-lang/rescript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
rescript-lang/rescript#9135 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
rescript-lang/rescript#9132 ·
Los mantenedores suelen responder en 1 día
-
Printed type declarations drop @tag, @notUndefined and runtime annotationsPosiblemente ocupada @cknitt la tomó hoy. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 25/100
rescript-lang/rescript#9134 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
rescript-lang/rescript#9130 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dev dependencies interactingPosiblemente ocupada @CarlOlson la tomó hace 2 días. Abierto
Dificultad 4/5 1-2 días Aptitud para principiantes 25/100
rescript-lang/rescript#9089 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de rescript-lang/rescript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 4 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
CanadaHonk/porffor#426 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
compiler-rt:asan llvm:transforms
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
llvm/llvm-project#236682 ·
Los mantenedores suelen responder en 1 día