Parser: an attribute or doc comment in front of a `{...` spread type changes how it is read
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- ocaml
- Ambito
- compilers
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- OCaml
- Stelle
- 7.5k
- Fork
- 484
- Merge medio
- 21h 9m
- PR unite (30g)
- 255
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rescript-lang/rescript
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
rescript-lang/rescript#9135 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
rescript-lang/rescript#9132 ·
I maintainer di solito rispondono entro 1 giorno
-
Printed type declarations drop @tag, @notUndefined and runtime annotationsForse già presa @cknitt l’ha presa oggi. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 25/100
rescript-lang/rescript#9134 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
rescript-lang/rescript#9130 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Dev dependencies interactingForse già presa @CarlOlson l’ha presa 3 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 25/100
rescript-lang/rescript#9089 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rescript-lang/rescript
Issue simili
-
bug medium priority openmp tokenizer wrong result
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
import: a segment starting with a digit is refused, but the error says digits are allowedForse già presa @sebastianbreguel l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
HigherOrderCO/Bend#1961 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 4 giorni
-
lane:core todo:ticket
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CanadaHonk/porffor#426 ·