parser: implement while loops, port while test
Implement in parser.c: - parseWhileExpr: while (cond) body, with optional payload, continue expression, and else clause - while_simple, while_cont, while AST nodes Port test "while else err prong with no block". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1517,6 +1517,18 @@ test "zig fmt: whitespace fixes" {
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: while else err prong with no block" {
|
||||
try testCanonical(
|
||||
\\test "" {
|
||||
\\ const result = while (returnError()) |value| {
|
||||
\\ break value;
|
||||
\\ } else |err| @as(i32, 2);
|
||||
\\ try expect(result == 2);
|
||||
\\}
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: tagged union with enum values" {
|
||||
try testCanonical(
|
||||
\\const MultipleChoice2 = union(enum(u32)) {
|
||||
|
||||
Reference in New Issue
Block a user