From 9f4408d68b4f3d0f8d80ed6a81d554da6efba058 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 14 Sep 2022 18:12:15 -0700 Subject: [PATCH] organize some compile error tests Many of these tests check for the incorrect behavior of stage1 whereas self-hosted correctly does not emit an error, so they are simply deleted. The remaining number of test cases within the stage1/ subdirectory is reduced from 143 to 103. --- .../{stage1 => }/catch_on_undefined_value.zig | 4 +-- .../div_assign_on_undefined_value.zig | 10 +++++++ .../compile_errors/div_on_undefined_value.zig | 10 +++++++ .../enum_field_value_references_enum.zig | 5 ++-- .../implicit_cast_from_f64_to_f32.zig | 18 +++++++++++++ .../mod_assign_on_undefined_value.zig | 10 +++++++ .../compile_errors/mod_on_undefined_value.zig | 10 +++++++ .../mult_assign_on_undefined_value.zig | 10 +++++++ .../mult_on_undefined_value.zig | 10 +++++++ .../negate_on_undefined_value.zig | 10 +++++++ .../orelse_on_undefined_value.zig | 4 +-- .../add_wrap_assign_on_undefined_value.zig | 10 ------- .../stage1/add_wrap_on_undefined_value.zig | 10 ------- .../stage1/alignCast_of_zero_sized_types.zig | 27 ------------------- .../aligned_variable_of_zero-bit_type.zig | 10 ------- .../bin_and_assign_on_undefined_value.zig | 10 ------- .../stage1/bin_and_on_undefined_value.zig | 10 ------- .../stage1/bin_not_on_undefined_value.zig | 10 ------- .../bin_or_assign_on_undefined_value.zig | 10 ------- .../stage1/bin_or_on_undefined_value.zig | 10 ------- .../bin_xor_assign_on_undefined_value.zig | 10 ------- .../stage1/bin_xor_on_undefined_value.zig | 10 ------- .../stage1/bool_not_on_undefined_value.zig | 10 ------- .../stage1/div_assign_on_undefined_value.zig | 10 ------- .../stage1/div_on_undefined_value.zig | 10 ------- .../stage1/implicit_cast_from_f64_to_f32.zig | 10 ------- .../stage1/int_to_ptr_of_0_bits.zig | 11 -------- .../stage1/mod_assign_on_undefined_value.zig | 10 ------- .../stage1/mod_on_undefined_value.zig | 10 ------- .../stage1/mult_assign_on_undefined_value.zig | 10 ------- .../stage1/mult_on_undefined_value.zig | 10 ------- .../mult_wrap_assign_on_undefined_value.zig | 10 ------- .../stage1/mult_wrap_on_undefined_value.zig | 10 ------- .../stage1/negate_on_undefined_value.zig | 10 ------- .../stage1/negate_wrap_on_undefined_value.zig | 10 ------- .../non_compile_time_array_concatenation.zig | 11 -------- ...ional_pointer_to_void_in_extern_struct.zig | 14 ---------- ...Cast_a_0_bit_type_to_a_non-_0_bit_type.zig | 13 --------- .../stage1/recursive_inferred_error_set.zig | 12 --------- .../shift_left_assign_on_undefined_value.zig | 10 ------- .../stage1/shift_left_on_undefined_value.zig | 10 ------- .../shift_right_assign_on_undefined_value.zig | 10 ------- .../stage1/shift_right_on_undefined_value.zig | 10 ------- .../stage1/sub_assign_on_undefined_value.zig | 10 ------- .../stage1/sub_on_undefined_value.zig | 10 ------- .../sub_wrap_assign_on_undefined_value.zig | 10 ------- .../stage1/sub_wrap_on_undefined_value.zig | 10 ------- .../stage1/truncate_undefined_value.zig | 10 ------- .../sub_assign_on_undefined_value.zig | 10 +++++++ .../compile_errors/sub_on_undefined_value.zig | 10 +++++++ 50 files changed, 115 insertions(+), 404 deletions(-) rename test/cases/compile_errors/{stage1 => }/catch_on_undefined_value.zig (52%) create mode 100644 test/cases/compile_errors/div_assign_on_undefined_value.zig create mode 100644 test/cases/compile_errors/div_on_undefined_value.zig rename test/cases/compile_errors/{stage1/obj => }/enum_field_value_references_enum.zig (64%) create mode 100644 test/cases/compile_errors/implicit_cast_from_f64_to_f32.zig create mode 100644 test/cases/compile_errors/mod_assign_on_undefined_value.zig create mode 100644 test/cases/compile_errors/mod_on_undefined_value.zig create mode 100644 test/cases/compile_errors/mult_assign_on_undefined_value.zig create mode 100644 test/cases/compile_errors/mult_on_undefined_value.zig create mode 100644 test/cases/compile_errors/negate_on_undefined_value.zig rename test/cases/compile_errors/{stage1 => }/orelse_on_undefined_value.zig (50%) delete mode 100644 test/cases/compile_errors/stage1/add_wrap_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/add_wrap_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/alignCast_of_zero_sized_types.zig delete mode 100644 test/cases/compile_errors/stage1/aligned_variable_of_zero-bit_type.zig delete mode 100644 test/cases/compile_errors/stage1/bin_and_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_and_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_not_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_or_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_or_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_xor_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bin_xor_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/bool_not_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/div_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/div_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/implicit_cast_from_f64_to_f32.zig delete mode 100644 test/cases/compile_errors/stage1/int_to_ptr_of_0_bits.zig delete mode 100644 test/cases/compile_errors/stage1/mod_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/mod_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/mult_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/mult_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/mult_wrap_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/mult_wrap_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/negate_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/negate_wrap_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/non_compile_time_array_concatenation.zig delete mode 100644 test/cases/compile_errors/stage1/optional_pointer_to_void_in_extern_struct.zig delete mode 100644 test/cases/compile_errors/stage1/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig delete mode 100644 test/cases/compile_errors/stage1/recursive_inferred_error_set.zig delete mode 100644 test/cases/compile_errors/stage1/shift_left_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/shift_left_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/shift_right_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/shift_right_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/sub_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/sub_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/sub_wrap_assign_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/sub_wrap_on_undefined_value.zig delete mode 100644 test/cases/compile_errors/stage1/truncate_undefined_value.zig create mode 100644 test/cases/compile_errors/sub_assign_on_undefined_value.zig create mode 100644 test/cases/compile_errors/sub_on_undefined_value.zig diff --git a/test/cases/compile_errors/stage1/catch_on_undefined_value.zig b/test/cases/compile_errors/catch_on_undefined_value.zig similarity index 52% rename from test/cases/compile_errors/stage1/catch_on_undefined_value.zig rename to test/cases/compile_errors/catch_on_undefined_value.zig index 53a5f1c2a9..6d368c0eda 100644 --- a/test/cases/compile_errors/stage1/catch_on_undefined_value.zig +++ b/test/cases/compile_errors/catch_on_undefined_value.zig @@ -4,7 +4,7 @@ comptime { } // error -// backend=stage1 +// backend=stage2 // target=native // -// tmp.zig:3:11: error: use of undefined value here causes undefined behavior +// :3:11: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/div_assign_on_undefined_value.zig b/test/cases/compile_errors/div_assign_on_undefined_value.zig new file mode 100644 index 0000000000..d0e4024459 --- /dev/null +++ b/test/cases/compile_errors/div_assign_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + a /= a; +} + +// error +// backend=stage2 +// target=native +// +// :3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/div_on_undefined_value.zig b/test/cases/compile_errors/div_on_undefined_value.zig new file mode 100644 index 0000000000..8365cdfa73 --- /dev/null +++ b/test/cases/compile_errors/div_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + _ = a / a; +} + +// error +// backend=stage2 +// target=native +// +// :3:13: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/obj/enum_field_value_references_enum.zig b/test/cases/compile_errors/enum_field_value_references_enum.zig similarity index 64% rename from test/cases/compile_errors/stage1/obj/enum_field_value_references_enum.zig rename to test/cases/compile_errors/enum_field_value_references_enum.zig index ebf32db5e0..9c876a12ca 100644 --- a/test/cases/compile_errors/stage1/obj/enum_field_value_references_enum.zig +++ b/test/cases/compile_errors/enum_field_value_references_enum.zig @@ -9,7 +9,8 @@ export fn entry() void { const D = 1; // error -// backend=stage1 +// backend=stage2 // target=native // -// tmp.zig:1:17: error: enum 'Foo' depends on itself +// :1:5: error: dependency loop detected +// :2:9: note: referenced here diff --git a/test/cases/compile_errors/implicit_cast_from_f64_to_f32.zig b/test/cases/compile_errors/implicit_cast_from_f64_to_f32.zig new file mode 100644 index 0000000000..79b57476a9 --- /dev/null +++ b/test/cases/compile_errors/implicit_cast_from_f64_to_f32.zig @@ -0,0 +1,18 @@ +var x: f64 = 1.0; +var y: f32 = x; + +export fn entry() void { + _ = y; +} +export fn entry2() void { + var x1: f64 = 1.0; + var y2: f32 = x1; + _ = y2; +} + +// error +// backend=llvm +// target=native +// +// :2:14: error: cannot load runtime value in comptime block +// :9:19: error: expected type 'f32', found 'f64' diff --git a/test/cases/compile_errors/mod_assign_on_undefined_value.zig b/test/cases/compile_errors/mod_assign_on_undefined_value.zig new file mode 100644 index 0000000000..0945979140 --- /dev/null +++ b/test/cases/compile_errors/mod_assign_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + a %= a; +} + +// error +// backend=stage2 +// target=native +// +// :3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/mod_on_undefined_value.zig b/test/cases/compile_errors/mod_on_undefined_value.zig new file mode 100644 index 0000000000..31f6f37815 --- /dev/null +++ b/test/cases/compile_errors/mod_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + _ = a % a; +} + +// error +// backend=stage2 +// target=native +// +// :3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/mult_assign_on_undefined_value.zig b/test/cases/compile_errors/mult_assign_on_undefined_value.zig new file mode 100644 index 0000000000..5cbc074e25 --- /dev/null +++ b/test/cases/compile_errors/mult_assign_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + a *= a; +} + +// error +// backend=stage2 +// target=native +// +// :3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/mult_on_undefined_value.zig b/test/cases/compile_errors/mult_on_undefined_value.zig new file mode 100644 index 0000000000..1ef459421a --- /dev/null +++ b/test/cases/compile_errors/mult_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + _ = a * a; +} + +// error +// backend=stage2 +// target=native +// +// :3:13: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/negate_on_undefined_value.zig b/test/cases/compile_errors/negate_on_undefined_value.zig new file mode 100644 index 0000000000..2e0ee4ed3b --- /dev/null +++ b/test/cases/compile_errors/negate_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + _ = -a; +} + +// error +// backend=stage2 +// target=native +// +// :3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/orelse_on_undefined_value.zig b/test/cases/compile_errors/orelse_on_undefined_value.zig similarity index 50% rename from test/cases/compile_errors/stage1/orelse_on_undefined_value.zig rename to test/cases/compile_errors/orelse_on_undefined_value.zig index 3042c208eb..e67cd952d3 100644 --- a/test/cases/compile_errors/stage1/orelse_on_undefined_value.zig +++ b/test/cases/compile_errors/orelse_on_undefined_value.zig @@ -4,7 +4,7 @@ comptime { } // error -// backend=stage1 +// backend=stage2 // target=native // -// tmp.zig:3:11: error: use of undefined value here causes undefined behavior +// :3:11: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/add_wrap_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/add_wrap_assign_on_undefined_value.zig deleted file mode 100644 index 5f9a4c61fc..0000000000 --- a/test/cases/compile_errors/stage1/add_wrap_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a +%= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/add_wrap_on_undefined_value.zig b/test/cases/compile_errors/stage1/add_wrap_on_undefined_value.zig deleted file mode 100644 index 582b8ec1cf..0000000000 --- a/test/cases/compile_errors/stage1/add_wrap_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a +% a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/alignCast_of_zero_sized_types.zig b/test/cases/compile_errors/stage1/alignCast_of_zero_sized_types.zig deleted file mode 100644 index 277301a06d..0000000000 --- a/test/cases/compile_errors/stage1/alignCast_of_zero_sized_types.zig +++ /dev/null @@ -1,27 +0,0 @@ -export fn foo() void { - const a: *void = undefined; - _ = @alignCast(2, a); -} -export fn bar() void { - const a: ?*void = undefined; - _ = @alignCast(2, a); -} -export fn baz() void { - const a: []void = undefined; - _ = @alignCast(2, a); -} -export fn qux() void { - const a = struct { - fn a(comptime b: u32) void { _ = b; } - }.a; - _ = @alignCast(2, a); -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:23: error: cannot adjust alignment of zero sized type '*void' -// tmp.zig:7:23: error: cannot adjust alignment of zero sized type '?*void' -// tmp.zig:11:23: error: cannot adjust alignment of zero sized type '[]void' -// tmp.zig:17:23: error: cannot adjust alignment of zero sized type 'fn(u32) anytype' diff --git a/test/cases/compile_errors/stage1/aligned_variable_of_zero-bit_type.zig b/test/cases/compile_errors/stage1/aligned_variable_of_zero-bit_type.zig deleted file mode 100644 index f09f92aca7..0000000000 --- a/test/cases/compile_errors/stage1/aligned_variable_of_zero-bit_type.zig +++ /dev/null @@ -1,10 +0,0 @@ -export fn f() void { - var s: struct {} align(4) = undefined; - _ = s; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:5: error: variable 's' of zero-bit type 'struct:2:12' has no in-memory representation, it cannot be aligned diff --git a/test/cases/compile_errors/stage1/bin_and_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_and_assign_on_undefined_value.zig deleted file mode 100644 index 1076f9abdb..0000000000 --- a/test/cases/compile_errors/stage1/bin_and_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a &= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_and_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_and_on_undefined_value.zig deleted file mode 100644 index a53d9a10ac..0000000000 --- a/test/cases/compile_errors/stage1/bin_and_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a & a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_not_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_not_on_undefined_value.zig deleted file mode 100644 index 7e0f554f0b..0000000000 --- a/test/cases/compile_errors/stage1/bin_not_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = ~a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_or_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_or_assign_on_undefined_value.zig deleted file mode 100644 index cc61fc03e1..0000000000 --- a/test/cases/compile_errors/stage1/bin_or_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a |= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_or_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_or_on_undefined_value.zig deleted file mode 100644 index 7ac30bcb4e..0000000000 --- a/test/cases/compile_errors/stage1/bin_or_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a | a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_xor_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_xor_assign_on_undefined_value.zig deleted file mode 100644 index 37e3eae321..0000000000 --- a/test/cases/compile_errors/stage1/bin_xor_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a ^= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bin_xor_on_undefined_value.zig b/test/cases/compile_errors/stage1/bin_xor_on_undefined_value.zig deleted file mode 100644 index f1656b6013..0000000000 --- a/test/cases/compile_errors/stage1/bin_xor_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a ^ a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/bool_not_on_undefined_value.zig b/test/cases/compile_errors/stage1/bool_not_on_undefined_value.zig deleted file mode 100644 index 5c99a9739b..0000000000 --- a/test/cases/compile_errors/stage1/bool_not_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: bool = undefined; - _ = !a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/div_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/div_assign_on_undefined_value.zig deleted file mode 100644 index 5f18e6286a..0000000000 --- a/test/cases/compile_errors/stage1/div_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a /= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/div_on_undefined_value.zig b/test/cases/compile_errors/stage1/div_on_undefined_value.zig deleted file mode 100644 index 9857b1c779..0000000000 --- a/test/cases/compile_errors/stage1/div_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a / a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/implicit_cast_from_f64_to_f32.zig b/test/cases/compile_errors/stage1/implicit_cast_from_f64_to_f32.zig deleted file mode 100644 index f18a46b7f5..0000000000 --- a/test/cases/compile_errors/stage1/implicit_cast_from_f64_to_f32.zig +++ /dev/null @@ -1,10 +0,0 @@ -var x: f64 = 1.0; -var y: f32 = x; - -export fn entry() usize { return @sizeOf(@TypeOf(y)); } - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:14: error: expected type 'f32', found 'f64' diff --git a/test/cases/compile_errors/stage1/int_to_ptr_of_0_bits.zig b/test/cases/compile_errors/stage1/int_to_ptr_of_0_bits.zig deleted file mode 100644 index 7b65cdf836..0000000000 --- a/test/cases/compile_errors/stage1/int_to_ptr_of_0_bits.zig +++ /dev/null @@ -1,11 +0,0 @@ -export fn foo() void { - var x: usize = 0x1000; - var y: *void = @intToPtr(*void, x); - _ = y; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:30: error: type '*void' has 0 bits and cannot store information diff --git a/test/cases/compile_errors/stage1/mod_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/mod_assign_on_undefined_value.zig deleted file mode 100644 index c127e256e8..0000000000 --- a/test/cases/compile_errors/stage1/mod_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a %= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/mod_on_undefined_value.zig b/test/cases/compile_errors/stage1/mod_on_undefined_value.zig deleted file mode 100644 index 8bd7774a46..0000000000 --- a/test/cases/compile_errors/stage1/mod_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a % a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/mult_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/mult_assign_on_undefined_value.zig deleted file mode 100644 index 04040b9756..0000000000 --- a/test/cases/compile_errors/stage1/mult_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a *= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/mult_on_undefined_value.zig b/test/cases/compile_errors/stage1/mult_on_undefined_value.zig deleted file mode 100644 index 0dcd2b02f2..0000000000 --- a/test/cases/compile_errors/stage1/mult_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a * a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/mult_wrap_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/mult_wrap_assign_on_undefined_value.zig deleted file mode 100644 index db54af9f0b..0000000000 --- a/test/cases/compile_errors/stage1/mult_wrap_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a *%= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/mult_wrap_on_undefined_value.zig b/test/cases/compile_errors/stage1/mult_wrap_on_undefined_value.zig deleted file mode 100644 index 9ad09f7e93..0000000000 --- a/test/cases/compile_errors/stage1/mult_wrap_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a *% a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/negate_on_undefined_value.zig b/test/cases/compile_errors/stage1/negate_on_undefined_value.zig deleted file mode 100644 index f8d5f6128d..0000000000 --- a/test/cases/compile_errors/stage1/negate_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = -a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/negate_wrap_on_undefined_value.zig b/test/cases/compile_errors/stage1/negate_wrap_on_undefined_value.zig deleted file mode 100644 index 4ca32956de..0000000000 --- a/test/cases/compile_errors/stage1/negate_wrap_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = -%a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:11: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/non_compile_time_array_concatenation.zig b/test/cases/compile_errors/stage1/non_compile_time_array_concatenation.zig deleted file mode 100644 index e70e6daf32..0000000000 --- a/test/cases/compile_errors/stage1/non_compile_time_array_concatenation.zig +++ /dev/null @@ -1,11 +0,0 @@ -fn f() []u8 { - return s ++ "foo"; -} -var s: [10]u8 = undefined; -export fn entry() usize { return @sizeOf(@TypeOf(f)); } - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:12: error: unable to evaluate constant expression diff --git a/test/cases/compile_errors/stage1/optional_pointer_to_void_in_extern_struct.zig b/test/cases/compile_errors/stage1/optional_pointer_to_void_in_extern_struct.zig deleted file mode 100644 index 552f672ad6..0000000000 --- a/test/cases/compile_errors/stage1/optional_pointer_to_void_in_extern_struct.zig +++ /dev/null @@ -1,14 +0,0 @@ -const Foo = extern struct { - x: ?*const void, -}; -const Bar = extern struct { - foo: Foo, - y: i32, -}; -export fn entry(bar: *Bar) void {_ = bar;} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:5: error: extern structs cannot contain fields of type '?*const void' diff --git a/test/cases/compile_errors/stage1/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig b/test/cases/compile_errors/stage1/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig deleted file mode 100644 index 2fc30d4a32..0000000000 --- a/test/cases/compile_errors/stage1/ptrCast_a_0_bit_type_to_a_non-_0_bit_type.zig +++ /dev/null @@ -1,13 +0,0 @@ -export fn entry() bool { - var x: u0 = 0; - const p = @ptrCast(?*u0, &x); - return p == null; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:15: error: '*u0' and '?*u0' do not have the same in-memory representation -// tmp.zig:3:31: note: '*u0' has no in-memory bits -// tmp.zig:3:24: note: '?*u0' has in-memory bits diff --git a/test/cases/compile_errors/stage1/recursive_inferred_error_set.zig b/test/cases/compile_errors/stage1/recursive_inferred_error_set.zig deleted file mode 100644 index 89a2a54cfa..0000000000 --- a/test/cases/compile_errors/stage1/recursive_inferred_error_set.zig +++ /dev/null @@ -1,12 +0,0 @@ -export fn entry() void { - foo() catch unreachable; -} -fn foo() !void { - try foo(); -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:5:5: error: cannot resolve inferred error set '@typeInfo(@typeInfo(@TypeOf(foo)).Fn.return_type.?).ErrorUnion.error_set': function 'foo' not fully analyzed yet diff --git a/test/cases/compile_errors/stage1/shift_left_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/shift_left_assign_on_undefined_value.zig deleted file mode 100644 index 575bf0ee6b..0000000000 --- a/test/cases/compile_errors/stage1/shift_left_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a >>= 2; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/shift_left_on_undefined_value.zig b/test/cases/compile_errors/stage1/shift_left_on_undefined_value.zig deleted file mode 100644 index abd06fbbab..0000000000 --- a/test/cases/compile_errors/stage1/shift_left_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a << 2; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/shift_right_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/shift_right_assign_on_undefined_value.zig deleted file mode 100644 index 575bf0ee6b..0000000000 --- a/test/cases/compile_errors/stage1/shift_right_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a >>= 2; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/shift_right_on_undefined_value.zig b/test/cases/compile_errors/stage1/shift_right_on_undefined_value.zig deleted file mode 100644 index e24cbe473a..0000000000 --- a/test/cases/compile_errors/stage1/shift_right_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a >> 2; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/sub_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/sub_assign_on_undefined_value.zig deleted file mode 100644 index 74b705a154..0000000000 --- a/test/cases/compile_errors/stage1/sub_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a -= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/sub_on_undefined_value.zig b/test/cases/compile_errors/stage1/sub_on_undefined_value.zig deleted file mode 100644 index 08c590ee3f..0000000000 --- a/test/cases/compile_errors/stage1/sub_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a - a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/sub_wrap_assign_on_undefined_value.zig b/test/cases/compile_errors/stage1/sub_wrap_assign_on_undefined_value.zig deleted file mode 100644 index 41aa1ca14b..0000000000 --- a/test/cases/compile_errors/stage1/sub_wrap_assign_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - a -%= a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:5: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/sub_wrap_on_undefined_value.zig b/test/cases/compile_errors/stage1/sub_wrap_on_undefined_value.zig deleted file mode 100644 index 68e4e78512..0000000000 --- a/test/cases/compile_errors/stage1/sub_wrap_on_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var a: i64 = undefined; - _ = a -% a; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:9: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/stage1/truncate_undefined_value.zig b/test/cases/compile_errors/stage1/truncate_undefined_value.zig deleted file mode 100644 index 67a1f17ba7..0000000000 --- a/test/cases/compile_errors/stage1/truncate_undefined_value.zig +++ /dev/null @@ -1,10 +0,0 @@ -export fn entry() void { - var z = @truncate(u8, @as(u16, undefined)); - _ = z; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:27: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/sub_assign_on_undefined_value.zig b/test/cases/compile_errors/sub_assign_on_undefined_value.zig new file mode 100644 index 0000000000..0a241106ac --- /dev/null +++ b/test/cases/compile_errors/sub_assign_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + a -= a; +} + +// error +// backend=stage2 +// target=native +// +// :3:10: error: use of undefined value here causes undefined behavior diff --git a/test/cases/compile_errors/sub_on_undefined_value.zig b/test/cases/compile_errors/sub_on_undefined_value.zig new file mode 100644 index 0000000000..f198a72efe --- /dev/null +++ b/test/cases/compile_errors/sub_on_undefined_value.zig @@ -0,0 +1,10 @@ +comptime { + var a: i64 = undefined; + _ = a - a; +} + +// error +// backend=stage2 +// target=native +// +// :3:13: error: use of undefined value here causes undefined behavior