From 21fa187abc2a06c9bd5cfe4355c5edbfb3177f6b Mon Sep 17 00:00:00 2001 From: mlugg Date: Sat, 11 Nov 2023 07:27:31 +0000 Subject: test: update cases to silence 'var is never mutated' errors --- .../cases/compile_errors/runtime_to_comptime_num.zig | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'test/cases/compile_errors/runtime_to_comptime_num.zig') diff --git a/test/cases/compile_errors/runtime_to_comptime_num.zig b/test/cases/compile_errors/runtime_to_comptime_num.zig index 8d4a3fb999..eb5d5fc630 100644 --- a/test/cases/compile_errors/runtime_to_comptime_num.zig +++ b/test/cases/compile_errors/runtime_to_comptime_num.zig @@ -1,19 +1,23 @@ pub export fn entry() void { var a: u32 = 0; + _ = &a; _ = @as(comptime_int, a); } pub export fn entry2() void { var a: u32 = 0; + _ = &a; _ = @as(comptime_float, a); } pub export fn entry3() void { comptime var aa: comptime_float = 0.0; var a: f32 = 4; + _ = &a; aa = a; } pub export fn entry4() void { comptime var aa: comptime_int = 0.0; var a: f32 = 4; + _ = &a; aa = a; } @@ -21,11 +25,11 @@ pub export fn entry4() void { // backend=stage2 // target=native // -// :3:27: error: unable to resolve comptime value -// :3:27: note: value being casted to 'comptime_int' must be comptime-known -// :7:29: error: unable to resolve comptime value -// :7:29: note: value being casted to 'comptime_float' must be comptime-known -// :12:10: error: unable to resolve comptime value -// :12:10: note: value being casted to 'comptime_float' must be comptime-known -// :17:10: error: unable to resolve comptime value -// :17:10: note: value being casted to 'comptime_int' must be comptime-known +// :4:27: error: unable to resolve comptime value +// :4:27: note: value being casted to 'comptime_int' must be comptime-known +// :9:29: error: unable to resolve comptime value +// :9:29: note: value being casted to 'comptime_float' must be comptime-known +// :15:10: error: unable to resolve comptime value +// :15:10: note: value being casted to 'comptime_float' must be comptime-known +// :21:10: error: unable to resolve comptime value +// :21:10: note: value being casted to 'comptime_int' must be comptime-known -- cgit v1.2.3