mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 23:29:03 +00:00
fix zig fmt regression
This commit is contained in:
parent
e5ffb94911
commit
28d449b38d
2 changed files with 11 additions and 1 deletions
|
|
@ -732,7 +732,7 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node
|
||||||
|
|
||||||
const block_expr = (try parseBlockExpr(arena, it, tree));
|
const block_expr = (try parseBlockExpr(arena, it, tree));
|
||||||
const assign_expr = if (block_expr == null)
|
const assign_expr = if (block_expr == null)
|
||||||
try expectNode(arena, it, tree, parseAdditionExpr, .{
|
try expectNode(arena, it, tree, parseAssignExpr, .{
|
||||||
.ExpectedBlockOrAssignment = .{ .token = it.index },
|
.ExpectedBlockOrAssignment = .{ .token = it.index },
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,16 @@ test "recovery: invalid comptime" {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "zig fmt: if statment" {
|
||||||
|
try testCanonical(
|
||||||
|
\\test "" {
|
||||||
|
\\ if (optional()) |some|
|
||||||
|
\\ bar = some.foo();
|
||||||
|
\\}
|
||||||
|
\\
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
test "zig fmt: top-level fields" {
|
test "zig fmt: top-level fields" {
|
||||||
try testCanonical(
|
try testCanonical(
|
||||||
\\a: did_you_know,
|
\\a: did_you_know,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue