Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Parser: an attribute or doc comment in front of a `{...` spread type changes how it is read

Abierto
#9,122 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rescript-lang/rescript

Todos los issues de rescript-lang/rescript

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.