Zig Version
0.11.0-dev.1838+3a73216b1
Steps to Reproduce and Observed Behavior
Compile this code (which is incorrectly using @as when it should be @intCast):
pub fn main() !void {
var arr: [3]u16 = undefined;
for (arr, 0..) |_, ix| {
arr[ix] = @as(u16, ix);
}
}
That yields this error:
src\main.zig:4:13: error: expected type 'u16', found 'usize'
arr[ix] = @as(u16, ix);
^~
Expected Behavior
The ^~ should be pointing to the ix.
For reference, without the @as:
pub fn main() !void {
var arr: [3]u16 = undefined;
for (arr, 0..) |_, ix| {
arr[ix] = ix;
}
}
The error indicator points to ix:
src\main.zig:4:19: error: expected type 'u16', found 'usize'
arr[ix] = ix;
^~
Zig Version
0.11.0-dev.1838+3a73216b1
Steps to Reproduce and Observed Behavior
Compile this code (which is incorrectly using
@aswhen it should be@intCast):That yields this error:
Expected Behavior
The
^~should be pointing to theix.For reference, without the
@as:The error indicator points to
ix: