Formatter: five cases where comments and doc comments are placed wrongly
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #9119 của @cknitt — đã merge
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- ocaml
- Lĩnh vực
- compilers
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- OCaml
- Star
- 7.5k
- Fork
- 484
- Merge trung bình
- 21 giờ 9 phút
- Pull request đã merge (30 ngày)
- 255
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rescript-lang/rescript
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
rescript-lang/rescript#9135 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
rescript-lang/rescript#9132 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Printed type declarations drop @tag, @notUndefined and runtime annotationsCó thể đã có người làm @cknitt đã nhận hôm nay. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 25/100
rescript-lang/rescript#9134 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
rescript-lang/rescript#9130 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
rescript-lang/rescript#9122 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rescript-lang/rescript
Issue tương tự
-
confirmed generated by fuzzer llvm:codegen miscompilation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
llvm/llvm-project#237380 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Source comments still name the removed set_observer_thresholds and set_observer_scale builtinsĐang mởarea:observer area:trace-tape found-by:code-review kind:docs-drift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
InauguralSystems/EigenScript#2212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug medium priority openmp tokenizer wrong result
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
import: a segment starting with a digit is refused, but the error says digits are allowedCó thể đã có người làm @sebastianbreguel đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
HigherOrderCO/Bend#1961 ·
-
bug pdd
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 60/100
objectionary/eo#9675 ·
Maintainer thường phản hồi trong vòng 1 ngày