Formatter: five cases where comments and doc comments are placed wrongly
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #9119 di @cknitt — integrata
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 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 with the formatter cases described in the issue and inspect parameters_should_hug in compiler/syntax/src/res_parsetree_viewer.ml for the first case. Reproduce each of the five examples and trace the comment handling and formatting paths involved. Done means all five format correctly and remain stable when formatted again, with case 4 preserving the AST; an open pull request is already linked.
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.
All five are stable when formatted again. The fourth changes the AST, and the others change only the layout.
- A doc comment on a single hugged parameter is printed with a line break and no indent:
let f = (/** r */ {x, y}) => xprints aslet f = (/** r */followed by{x, y}) => xat column 0. The same happens for[a],(a, b)and().parameters_should_hugchecks the parameter'sattrsbut notpat.ppat_attributes, where the doc comment is stored. This input is accepted since #9055. - A trailing line comment after a parenthesized
switch/ifoperand moves into the block, followed by a blank line:
switch (x) // c1then{ | 1 => 2 | _ => 3 }prints asswitch x {, then// c1, a blank line and| 1 => 2. Without the parentheses (#9061) the comment stays with the operand. - A comment before a list tail spread moves after the dots:
list{1, /* c */ ...xs}prints aslist{1, .../* c */ xs}. Arrays keep it in place. - Doc comments are printed before an attribute that precedes them, which changes the attribute order in the AST:
type u = /** d1 */ @a /** d2 */ {x: int}prints/** d1 */,/** d2 */, then@a type u = {x: int}. - A file that contains only a line comment gets an extra trailing newline:
// c\nformats as// c\n\n.
Cases 2, 3 and 5 reproduce at b123b7c3. That revision rejects the inputs of 1 and 4.
🤖 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
-
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
rescript-lang/rescript#9122 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rescript-lang/rescript
Issue simili
-
confirmed generated by fuzzer llvm:codegen miscompilation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
llvm/llvm-project#237380 ·
I maintainer di solito rispondono entro 1 giorno
-
Source comments still name the removed set_observer_thresholds and set_observer_scale builtinsApertaarea:observer area:trace-tape found-by:code-review kind:docs-drift
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
InauguralSystems/EigenScript#2212 ·
I maintainer di solito rispondono entro 1 giorno
-
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 ·
-
bug pdd
Difficoltà 2/5 Meno di un'ora Idoneità per principianti 60/100
objectionary/eo#9675 ·
I maintainer di solito rispondono entro 1 giorno