update test-cases for new for loop syntax

This commit is contained in:
Andrew Kelley 2023-02-18 11:44:38 -07:00
parent b6a5e52dec
commit 8c96d0dddd
3 changed files with 5 additions and 5 deletions

View File

@ -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);
}
}

View File

@ -1,6 +1,6 @@
export fn returns() void {
for ([_]void{}) |_, i| {
for ([_]void{}) |_, j| {
for ([_]void{}, 0..) |_, i| {
for ([_]void{}, 0..) |_, j| {
return _;
}
}

View File

@ -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