authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-05-17 17:43:25+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-05-17 17:43:25+03:00
log241984987b394ea73ff17fa60846b1e0e85e3433
tree5e9594566275324b297045333597ccd15d9f16aa
parente5ffb94911b23ed916b52a28d8d91aa3f9ebc171
parent28d449b38d6bbf4081bed9fc58685fd5ca36423f
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #5367 from Vexu/fix

Fix zig fmt regression

2 files changed, 11 insertions(+), 1 deletions(-)

lib/std/zig/parse.zig+1-1
...@@ -732,7 +732,7 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node...@@ -732,7 +732,7 @@ fn parseIfStatement(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node
732732
733 const block_expr = (try parseBlockExpr(arena, it, tree));733 const block_expr = (try parseBlockExpr(arena, it, tree));
734 const assign_expr = if (block_expr == null)734 const assign_expr = if (block_expr == null)
735 try expectNode(arena, it, tree, parseAdditionExpr, .{735 try expectNode(arena, it, tree, parseAssignExpr, .{
736 .ExpectedBlockOrAssignment = .{ .token = it.index },736 .ExpectedBlockOrAssignment = .{ .token = it.index },
737 })737 })
738 else738 else
lib/std/zig/parser_test.zig+10
...@@ -208,6 +208,16 @@ test "recovery: invalid comptime" {...@@ -208,6 +208,16 @@ test "recovery: invalid comptime" {
208 });208 });
209}209}
210210
211test "zig fmt: if statment" {
212 try testCanonical(
213 \\test "" {
214 \\ if (optional()) |some|
215 \\ bar = some.foo();
216 \\}
217 \\
218 );
219}
220
211test "zig fmt: top-level fields" {221test "zig fmt: top-level fields" {
212 try testCanonical(222 try testCanonical(
213 \\a: did_you_know,223 \\a: did_you_know,