Merge pull request #5367 from Vexu/fix

Fix zig fmt regression
This commit is contained in:
Veikka Tuominen
2020-05-17 17:43:25 +03:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -732,7 +732,7 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node
const block_expr = (try parseBlockExpr(arena, it, tree));
const assign_expr = if (block_expr == null)
try expectNode(arena, it, tree, parseAdditionExpr, .{
try expectNode(arena, it, tree, parseAssignExpr, .{
.ExpectedBlockOrAssignment = .{ .token = it.index },
})
else

View File

@@ -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" {
try testCanonical(
\\a: did_you_know,