| author | |
| committer | |
| log | 40b6e86a999ce80b9f71c7a88df6186400f151ac |
| tree | a66bf1128d0bb465d35b042c4b6d5707d9fa2ecc |
| parent | c06674e701fdd74165778dd46b72cc469ba29140 |
2 files changed, 19 insertions(+), 1 deletions(-)
lib/std/zig/parser_test.zig+18| ... | ... | @@ -3583,6 +3583,24 @@ test "zig fmt: use of comments and Multiline string literals may force the param |
| 3583 | 3583 | ); |
| 3584 | 3584 | } |
| 3585 | 3585 | |
| 3586 | test "zig fmt: single argument trailing commas in @builtins()" { | |
| 3587 | try testCanonical( | |
| 3588 | \\pub fn foo(qzz: []u8) i1 { | |
| 3589 | \\ @panic( | |
| 3590 | \\ foo, | |
| 3591 | \\ ); | |
| 3592 | \\ panic( | |
| 3593 | \\ foo, | |
| 3594 | \\ ); | |
| 3595 | \\ @panic( | |
| 3596 | \\ foo, | |
| 3597 | \\ bar, | |
| 3598 | \\ ); | |
| 3599 | \\} | |
| 3600 | \\ | |
| 3601 | ); | |
| 3602 | } | |
| 3603 | ||
| 3586 | 3604 | const std = @import("std"); |
| 3587 | 3605 | const mem = std.mem; |
| 3588 | 3606 | const warn = std.debug.warn; |
lib/std/zig/render.zig+1-1| ... | ... | @@ -1489,7 +1489,7 @@ fn renderExpression( |
| 1489 | 1489 | try renderToken(tree, ais, builtin_call.builtin_token, Space.None); // @name |
| 1490 | 1490 | |
| 1491 | 1491 | const src_params_trailing_comma = blk: { |
| 1492 | if (builtin_call.params_len < 2) break :blk false; | |
| 1492 | if (builtin_call.params_len == 0) break :blk false; | |
| 1493 | 1493 | const last_node = builtin_call.params()[builtin_call.params_len - 1]; |
| 1494 | 1494 | const maybe_comma = tree.nextToken(last_node.lastToken()); |
| 1495 | 1495 | break :blk tree.token_ids[maybe_comma] == .Comma; |