Commit 1b8eca030e
Changed files (2)
lib
std
lib/std/zig/ast.zig
@@ -580,7 +580,7 @@ pub const Tree = struct {
.switch_case => {
const extra = tree.extraData(datas[n].lhs, Node.SubRange);
assert(extra.end - extra.start > 0);
- n = extra.start;
+ n = tree.extra_data[extra.start];
},
.asm_output, .asm_input => {
lib/std/zig/parser_test.zig
@@ -4189,19 +4189,18 @@ test "zig fmt: respect extra newline between fn and pub usingnamespace" {
);
}
-// TODO
-//test "zig fmt: respect extra newline between switch items" {
-// try testCanonical(
-// \\const a = switch (b) {
-// \\ .c => {},
-// \\
-// \\ .d,
-// \\ .e,
-// \\ => f,
-// \\};
-// \\
-// );
-//}
+test "zig fmt: respect extra newline between switch items" {
+ try testCanonical(
+ \\const a = switch (b) {
+ \\ .c => {},
+ \\
+ \\ .d,
+ \\ .e,
+ \\ => f,
+ \\};
+ \\
+ );
+}
test "zig fmt: error for invalid bit range" {
try testError(