diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig index aa92f42e240507361799e60bdb47d98cafc86647..2fa07d0de7971b9178470736d51cb946315022a3 100644 --- a/test/behavior/eval.zig +++ b/test/behavior/eval.zig @@ -1401,20 +1401,6 @@ test "continue in inline for inside a comptime switch" { try expect(count == 4); } -test "continue nested inline for loop" { - var a: u8 = 0; - loop: inline for ([_]u8{ 1, 2 }) |x| { - inline for ([_]u8{1}) |y| { - if (x == y) { - continue :loop; - } - } - a = x; - try expect(x == 2); - } - try expect(a == 2); -} - test "length of global array is determinable at comptime" { const S = struct { var bytes: [1024]u8 = undefined; @@ -1425,3 +1411,39 @@ test "length of global array is determinable at comptime" { }; comptime try S.foo(); } + +test "continue nested inline for loop" { + // TODO: https://github.com/ziglang/zig/issues/13175 + if (builtin.zig_backend != .stage1) return error.SkipZigTest; + + var a: u8 = 0; + loop: inline for ([_]u8{ 1, 2 }) |x| { + inline for ([_]u8{1}) |y| { + if (x == y) { + continue :loop; + } + } + a = x; + try expect(x == 2); + } + try expect(a == 2); +} + +test "continue nested inline for loop in named block expr" { + // TODO: https://github.com/ziglang/zig/issues/13175 + if (builtin.zig_backend != .stage1) return error.SkipZigTest; + + var a: u8 = 0; + loop: inline for ([_]u8{ 1, 2 }) |x| { + a = b: { + inline for ([_]u8{1}) |y| { + if (x == y) { + continue :loop; + } + } + break :b x; + }; + try expect(x == 2); + } + try expect(a == 2); +}