diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 11:44:38 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 19:17:21 -0700 |
| commit | 8c96d0dddddfb4cd597661ff47551fcaf67cbf39 (patch) | |
| tree | 4851da7ab2584ff1776e18e6886211a443a3e95f /test | |
| parent | b6a5e52decf4494d9506caa929139b630ce08dea (diff) | |
| download | zig-8c96d0dddddfb4cd597661ff47551fcaf67cbf39.tar.gz zig-8c96d0dddddfb4cd597661ff47551fcaf67cbf39.zip | |
update test-cases for new for loop syntax
Diffstat (limited to 'test')
3 files changed, 5 insertions, 5 deletions
diff --git a/test/cases/compile_errors/invalid_pointer_for_var_type.zig b/test/cases/compile_errors/invalid_pointer_for_var_type.zig index ee193bab15..d94c7bd3b8 100644 --- a/test/cases/compile_errors/invalid_pointer_for_var_type.zig +++ b/test/cases/compile_errors/invalid_pointer_for_var_type.zig @@ -1,7 +1,7 @@ extern fn ext() usize; var bytes: [ext()]u8 = undefined; export fn f() void { - for (bytes) |*b, i| { + for (&bytes, 0..) |*b, i| { b.* = @as(u8, i); } } diff --git a/test/cases/compile_errors/underscore_should_not_be_usable_inside_for.zig b/test/cases/compile_errors/underscore_should_not_be_usable_inside_for.zig index 1fb79e11bd..b527d0d17e 100644 --- a/test/cases/compile_errors/underscore_should_not_be_usable_inside_for.zig +++ b/test/cases/compile_errors/underscore_should_not_be_usable_inside_for.zig @@ -1,6 +1,6 @@ export fn returns() void { - for ([_]void{}) |_, i| { - for ([_]void{}) |_, j| { + for ([_]void{}, 0..) |_, i| { + for ([_]void{}, 0..) |_, j| { return _; } } diff --git a/test/cases/variable_shadowing.3.zig b/test/cases/variable_shadowing.3.zig index 1e22ccf123..3d899e72cc 100644 --- a/test/cases/variable_shadowing.3.zig +++ b/test/cases/variable_shadowing.3.zig @@ -1,10 +1,10 @@ pub fn main() void { var i = 0; - for ("n") |_, i| { + for ("n", 0..) |_, i| { } } // error // -// :3:19: error: loop index capture 'i' shadows local variable from outer scope +// :3:24: error: capture 'i' shadows local variable from outer scope // :2:9: note: previous declaration here |
