parser: warn on missing for loop payload, recover from invalid global error set access
This commit is contained in:
@@ -4215,6 +4215,8 @@ test "recovery: invalid global error set access" {
|
||||
\\}
|
||||
, &[_]Error{
|
||||
.expected_token,
|
||||
.expected_token,
|
||||
.invalid_and,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -4273,6 +4275,20 @@ test "recovery: missing block after for/while loops" {
|
||||
});
|
||||
}
|
||||
|
||||
test "recovery: missing for payload" {
|
||||
try testError(
|
||||
\\comptime {
|
||||
\\ const a = for(a) {};
|
||||
\\ const a: for(a) {};
|
||||
\\ for(a) {}
|
||||
\\}
|
||||
, &[_]Error{
|
||||
.expected_loop_payload,
|
||||
.expected_loop_payload,
|
||||
.expected_loop_payload,
|
||||
});
|
||||
}
|
||||
|
||||
const std = @import("std");
|
||||
const mem = std.mem;
|
||||
const warn = std.debug.warn;
|
||||
|
||||
Reference in New Issue
Block a user