| author | |
| committer | |
| log | 1658becb6221f9ffdbfd653c5e295501ac338794 |
| tree | 572a3a2c99d61dd924f6ecf55f303e155541b3dc |
| parent | 5504f155aa83c7fc9a3610b2dcd38d0c1fc3a0c9 |
2 files changed, 12 insertions(+), 0 deletions(-)
lib/std/zig/parser_test.zig+10| ... | @@ -7,6 +7,16 @@ test "zig fmt: trailing comma in container declaration" { | ... | @@ -7,6 +7,16 @@ test "zig fmt: trailing comma in container declaration" { |
| 7 | \\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 }; | 7 | \\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 }; |
| 8 | \\ | 8 | \\ |
| 9 | ); | 9 | ); |
| 10 | try testCanonical( | ||
| 11 | \\test "" { | ||
| 12 | \\ comptime { | ||
| 13 | \\ const X = struct { | ||
| 14 | \\ x: i32 | ||
| 15 | \\ }; | ||
| 16 | \\ } | ||
| 17 | \\} | ||
| 18 | \\ | ||
| 19 | ); | ||
| 10 | try testTransform( | 20 | try testTransform( |
| 11 | \\const X = struct { | 21 | \\const X = struct { |
| 12 | \\ foo: i32, bar: i8 }; | 22 | \\ foo: i32, bar: i8 }; |
lib/std/zig/render.zig+2| ... | @@ -1224,6 +1224,8 @@ fn renderExpression( | ... | @@ -1224,6 +1224,8 @@ fn renderExpression( |
| 1224 | const space_after_decl: Space = if (it.peek() == null) .Newline else .Space; | 1224 | const space_after_decl: Space = if (it.peek() == null) .Newline else .Space; |
| 1225 | try renderContainerDecl(allocator, stream, tree, new_indent, start_col, decl.*, space_after_decl); | 1225 | try renderContainerDecl(allocator, stream, tree, new_indent, start_col, decl.*, space_after_decl); |
| 1226 | } | 1226 | } |
| 1227 | |||
| 1228 | try stream.writeByteNTimes(' ', indent); | ||
| 1227 | } else { | 1229 | } else { |
| 1228 | // All the declarations on the same line | 1230 | // All the declarations on the same line |
| 1229 | try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Space); // { | 1231 | try renderToken(tree, stream, container_decl.lbrace_token, indent, start_col, .Space); // { |