Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Parser rejects `private @attr {…}` and a doc comment before a non-record type

Aperta
#9,106 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@cknitt ci sta già lavorando.

Dal 28/10/2026.

  • #9115 di @cknitt — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
ocaml
Ambito
compilers

Direzione di ricerca

Start in compiler/syntax/src/res_core.ml at parse_private_eq_or_repr and the type representation dispatch around the cited lines. Trace how private attributes and DocComment tokens reach parse_typ_expr or parse_type_representation, then check nearby parser tests for the corresponding syntax cases. Done means both examples and the listed related type forms parse without changing existing cases; pull request #9115 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Found by a bug hunt over the 16 commits from eb087382 to cd641cbc.

private followed by an attribute and a record.

type t = private @attr {x: int}

This fails with "An inline record type declaration is only allowed in a variant constructor's declaration or nested inside of a record type declaration". type t = @attr {x: int} (#8919) and type u = private {x: int} both parse. At counts as the start of a type expression (res_grammar.ml#L205), so parse_private_eq_or_repr parses @attr {x: int} with parse_typ_expr (res_core.ml#L5802-L5803). The non-private path has its own At lookahead (res_core.ml#L6043).

A doc comment after = in front of a non-record type.

type z = /** d */ int

This fails with "Did you mean Int instead of int?". {"a": int}, (int, int) and [#A] fail the same way. /** d */ {x: int}, /** d */ A | B and @attr int parse. res_core.ml#L6037 sends DocComment straight to parse_type_representation. The At case at the next arm looks ahead for objects and manifests first.

Both reproduce at b123b7c3.

🤖 Generated with Claude Code

Lingua principale
OCaml
Stelle
7.5k
Fork
484
Merge medio
20h 19m
PR unite (30g)
242

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rescript-lang/rescript

Tutte le issue di rescript-lang/rescript

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.