| author | |
| committer | |
| log | 28d449b38d6bbf4081bed9fc58685fd5ca36423f |
| tree | 5e9594566275324b297045333597ccd15d9f16aa |
| parent | e5ffb94911b23ed916b52a28d8d91aa3f9ebc171 |
| signature | Commit is signed but in an unrecognized format. |
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 |
| 732 | 732 | ||
| 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 | else | 738 | 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 | } |
| 210 | 210 | ||
| 211 | test "zig fmt: if statment" { | ||
| 212 | try testCanonical( | ||
| 213 | \\test "" { | ||
| 214 | \\ if (optional()) |some| | ||
| 215 | \\ bar = some.foo(); | ||
| 216 | \\} | ||
| 217 | \\ | ||
| 218 | ); | ||
| 219 | } | ||
| 220 | |||
| 211 | test "zig fmt: top-level fields" { | 221 | test "zig fmt: top-level fields" { |
| 212 | try testCanonical( | 222 | try testCanonical( |
| 213 | \\a: did_you_know, | 223 | \\a: did_you_know, |