test: update cases to silence 'var is never mutated' errors

This commit is contained in:
mlugg
2023-11-11 07:27:31 +00:00
parent 2c1acb6180
commit 21fa187abc
289 changed files with 671 additions and 489 deletions

View File

@@ -1,17 +1,21 @@
export fn foo() void {
var a: u32 = 2;
_ = &a;
_ = @as(comptime_int, @intCast(a));
}
export fn bar() void {
var a: u32 = 2;
_ = &a;
_ = @as(u32, @floatFromInt(a));
}
export fn baz() void {
var a: u32 = 2;
_ = &a;
_ = @as(u32, @intFromFloat(a));
}
export fn qux() void {
var a: f32 = 2;
_ = &a;
_ = @as(u32, @intCast(a));
}
@@ -19,7 +23,7 @@ export fn qux() void {
// backend=stage2
// target=native
//
// :3:36: error: unable to cast runtime value to 'comptime_int'
// :7:18: error: expected float type, found 'u32'
// :11:32: error: expected float type, found 'u32'
// :15:27: error: expected integer or vector, found 'f32'
// :4:36: error: unable to cast runtime value to 'comptime_int'
// :9:18: error: expected float type, found 'u32'
// :14:32: error: expected float type, found 'u32'
// :19:27: error: expected integer or vector, found 'f32'