Commit 9ada7638a5
Changed files (2)
lib
std
lib/std/zig/parse.zig
@@ -2656,6 +2656,10 @@ const Parser = struct {
p.tok_i += 2;
return p.parseWhileTypeExpr();
},
+ .l_brace => {
+ p.tok_i += 2;
+ return p.parseBlock();
+ },
else => return p.addNode(.{
.tag = .identifier,
.main_token = p.nextToken(),
lib/std/zig/parser_test.zig
@@ -4179,6 +4179,17 @@ test "zig fmt: proper indent line comment after multi-line single expr while loo
);
}
+test "zig fmt: function with labeled block as return type" {
+ try testCanonical(
+ \\fn foo() t: {
+ \\ break :t bar;
+ \\} {
+ \\ baz();
+ \\}
+ \\
+ );
+}
+
test "zig fmt: line comment after multiline single expr if statement with multiline string" {
try testCanonical(
\\test {