parse.zig: make parseForTypeExpr accept only a TypeExpr as body

This commit is contained in:
Matthew Borkowski 2021-06-11 18:23:38 -04:00 committed by Veikka Tuominen
parent 3692fb039d
commit 483933d88d
2 changed files with 2 additions and 2 deletions

View File

@ -2616,7 +2616,7 @@ const Parser = struct {
const found_payload = try p.parsePtrIndexPayload();
if (found_payload == 0) try p.warn(.expected_loop_payload);
const then_expr = try p.expectExpr();
const then_expr = try p.expectTypeExpr();
const else_token = p.eatToken(.keyword_else) orelse {
return p.addNode(.{
.tag = .for_simple,

View File

@ -5154,7 +5154,7 @@ test "recovery: missing for payload" {
try testError(
\\comptime {
\\ const a = for(a) {};
\\ const a: for(a) {};
\\ const a: for(a) blk: {};
\\ for(a) {}
\\}
, &[_]Error{