diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-07-13 15:59:46 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-07-13 16:10:41 -0700 |
| commit | fad95741db7529bbad873fb330c25d64ac765340 (patch) | |
| tree | 22ca663d66d22bccc6ffe9ac0d2c676ed8bb0636 /test/behavior/while.zig | |
| parent | 1fee9eac8bb5d2e3e78c098b9cebe2cda332e7cf (diff) | |
| download | zig-fad95741db7529bbad873fb330c25d64ac765340.tar.gz zig-fad95741db7529bbad873fb330c25d64ac765340.zip | |
AstGen: fix loop control flow applying to wrong loop
In the case of 'continue' or 'break' inside the 'else' block of a
'while' or 'for' loop.
Closes #12109
Diffstat (limited to 'test/behavior/while.zig')
| -rw-r--r-- | test/behavior/while.zig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/behavior/while.zig b/test/behavior/while.zig index b664e73b89..62d5bf90fa 100644 --- a/test/behavior/while.zig +++ b/test/behavior/while.zig @@ -334,3 +334,13 @@ test "continue inline while loop" { } comptime assert(i == 5); } + +test "else continue outer while" { + var i: usize = 0; + while (true) { + i += 1; + while (i > 5) { + return; + } else continue; + } +} |
