Formatter: five cases where comments and doc comments are placed wrongly
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- ocaml
- Domínio
- compilers
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- OCaml
- Estrelas
- 7.5k
- Forks
- 484
- Merge médio
- 20h 19min
- PRs com merge (30d)
- 242
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de rescript-lang/rescript
-
Record coercion can construct a private record from outside its moduleTalvez já em andamento @cknitt assumiu hoje. Aberta
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 52/100
rescript-lang/rescript#9124 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 56/100
rescript-lang/rescript#9123 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 55/100
rescript-lang/rescript#9122 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
rescript-lang/rescript#9109 ·
Mantenedores costumam responder em até 1 dia
-
Parser rejects `private @attr {…}` and a doc comment before a non-record typeTalvez já em andamento @cknitt assumiu há 1 dia. Aberta
Dificuldade 4/5 1-2 dias Facilidade para iniciantes 35/100
rescript-lang/rescript#9106 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de rescript-lang/rescript
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
CanadaHonk/porffor#426 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
compiler-rt:asan llvm:transforms
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
llvm/llvm-project#236682 ·
Mantenedores costumam responder em até 1 dia
-
Lexer: Turbopack magic comments are not classifiedTalvez já em andamento @Aschenbath assumiu hoje. AbertaA-lexer
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
oxc-project/oxc#28320 · 1 comentário ·
Mantenedores costumam responder em até 1 dia