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

Formatter drops a comment before the spread of a list pattern like `list{/* c */ ...r}`

Chiusa
#9,123 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #9127 di @cknitt — integrata

Valutazione

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

Direzione di ricerca

Start by reading the formatter and pattern printing code for list patterns, then trace how comments attached to a spread are handled when list{...r} parses to r. Reproduce with the supplied bsc -format example and compare it with the expression case and the list{a, /* e */ ...r} case. Done means formatting preserves /* d */ in the pattern.

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

Descrizione

Formatting drops a comment written before the spread of a list pattern that has no other items.

let f = x =>
  switch x {
  | list{/* d */ ...r} => r
  }

bsc -format (master at 3562ce6b80) prints:

let f = x =>
  switch x {
  | r => r
  }

The comment /* d */ is gone. list{...r} parses to the pattern r itself, so the printer prints r, and the comment attached to the spread is never printed. The expression list{/* h */ ...xs} keeps its comment (/* h */ xs), and list{a, /* e */ ...r} keeps it too (with #9119).

Found while working on #9107; #9119 does not change this case.

🤖 Generated with Claude Code

Lingua principale
OCaml
Stelle
7.5k
Fork
484
Merge medio
21h 9m
PR unite (30g)
255

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.