Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Geschlossen
#9,123 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Ein zugehöriger Pull Request wurde bereits gemerged.

  • #9127 von @cknitt — gemerged

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
56/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
ocaml
Bereich
compilers

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
OCaml
Sterne
7.5k
Forks
484
Ø Merge
20 Std. 43 Min.
Gemergte PRs (30 T.)
263

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus rescript-lang/rescript

Alle Issues in rescript-lang/rescript

Ähnliche Issues

Weitere Issues zu Compilers

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.