commit a74119ac49230a40012c0dd979e4c35eefcfd66a (tree)
parent dd75e7bcb1fe142f4d60dc2d83e6feee53e580f3
Author: xdBronch <51252236+xdBronch@users.noreply.github.com>
Date: Thu, 12 Jun 2025 13:43:35 -0400
bail when failing to parse `error`
Diffstat:
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/std/zig/Parse.zig b/lib/std/zig/Parse.zig
@@ -2774,9 +2774,9 @@ fn parsePrimaryTypeExpr(p: *Parse) !?Node.Index {
else => {
const main_token = p.nextToken();
const period = p.eatToken(.period);
- if (period == null) try p.warnExpected(.period);
+ if (period == null) return p.failExpected(.period);
const identifier = p.eatToken(.identifier);
- if (identifier == null) try p.warnExpected(.identifier);
+ if (identifier == null) return p.failExpected(.identifier);
return try p.addNode(.{
.tag = .error_value,
.main_token = main_token,
diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig
@@ -6280,7 +6280,6 @@ test "recovery: invalid global error set access" {
\\}
, &[_]Error{
.expected_token,
- .expected_token,
});
}