v
v copied to clipboard
ast, parser, fmt: fix fmt error of infix expr with comments (fix #17560)
This PR fix fmt error of infix expr with comments (fix #17560).
- Fix fmt error of infix expr with comments.
- Add test.
infix_expr_with_comments_keep.vv
fn main() {
a := 4 // comment1
+ /* comment2 */ 6
b := 5 /* comment1 */ + // comment2
6
c := 4 /* comment1 */ + /* comment2 */ 6 // comment3
}
Inline comments are tricky with our implementation. I think it's better to ban them.
Otherwise we'd have to re-write comments entirely, handle them like in Go.
Although this PR seems to handle a large percentage of them.
Inline comments are tricky with our implementation. I think it's better to ban them.
Very much agree with this just like zig.