From f1768b40b2468d63355c8cf83d3614ae23a54317 Mon Sep 17 00:00:00 2001 From: Veikka Tuominen Date: Thu, 28 Jul 2022 17:28:37 +0300 Subject: stage2: better source location for var decls --- .../compile_errors/global_variable_alignment_non_power_of_2.zig | 8 ++++++++ test/cases/compile_errors/src_outside_function.zig | 9 +++++++++ .../stage1/obj/global_variable_alignment_non_power_of_2.zig | 8 -------- test/cases/compile_errors/stage1/obj/src_outside_function.zig | 9 --------- test/cases/compile_errors/type_variables_must_be_constant.zig | 4 ++-- .../compile_errors/use_invalid_number_literal_as_array_index.zig | 4 ++-- test/cases/compile_errors/usingnamespace_with_wrong_type.zig | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig create mode 100644 test/cases/compile_errors/src_outside_function.zig delete mode 100644 test/cases/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig delete mode 100644 test/cases/compile_errors/stage1/obj/src_outside_function.zig (limited to 'test/cases') diff --git a/test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig b/test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig new file mode 100644 index 0000000000..b88d8aaf70 --- /dev/null +++ b/test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig @@ -0,0 +1,8 @@ +const some_data: [100]u8 align(3) = undefined; +export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } + +// error +// backend=stage2 +// target=native +// +// :1:32: error: alignment value '3' is not a power of two diff --git a/test/cases/compile_errors/src_outside_function.zig b/test/cases/compile_errors/src_outside_function.zig new file mode 100644 index 0000000000..8b66ba730b --- /dev/null +++ b/test/cases/compile_errors/src_outside_function.zig @@ -0,0 +1,9 @@ +comptime { + @src(); +} + +// error +// backend=stage2 +// target=native +// +// :2:5: error: @src outside function diff --git a/test/cases/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig b/test/cases/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig deleted file mode 100644 index f23f340b16..0000000000 --- a/test/cases/compile_errors/stage1/obj/global_variable_alignment_non_power_of_2.zig +++ /dev/null @@ -1,8 +0,0 @@ -const some_data: [100]u8 align(3) = undefined; -export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } - -// error -// backend=stage1 -// target=native -// -// tmp.zig:1:32: error: alignment value 3 is not a power of 2 diff --git a/test/cases/compile_errors/stage1/obj/src_outside_function.zig b/test/cases/compile_errors/stage1/obj/src_outside_function.zig deleted file mode 100644 index 7f8c7ae72f..0000000000 --- a/test/cases/compile_errors/stage1/obj/src_outside_function.zig +++ /dev/null @@ -1,9 +0,0 @@ -comptime { - @src(); -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:5: error: @src outside function diff --git a/test/cases/compile_errors/type_variables_must_be_constant.zig b/test/cases/compile_errors/type_variables_must_be_constant.zig index 35e94f3641..1dbddc126c 100644 --- a/test/cases/compile_errors/type_variables_must_be_constant.zig +++ b/test/cases/compile_errors/type_variables_must_be_constant.zig @@ -7,5 +7,5 @@ export fn entry() foo { // backend=stage2 // target=native // -// :1:1: error: variable of type 'type' must be const or comptime -// :1:1: note: types are not available at runtime +// :1:5: error: variable of type 'type' must be const or comptime +// :1:5: note: types are not available at runtime diff --git a/test/cases/compile_errors/use_invalid_number_literal_as_array_index.zig b/test/cases/compile_errors/use_invalid_number_literal_as_array_index.zig index 120ba5c588..c52f614657 100644 --- a/test/cases/compile_errors/use_invalid_number_literal_as_array_index.zig +++ b/test/cases/compile_errors/use_invalid_number_literal_as_array_index.zig @@ -8,5 +8,5 @@ export fn entry() void { // backend=stage2 // target=native // -// :1:1: error: variable of type 'comptime_int' must be const or comptime -// :1:1: note: to modify this variable at runtime, it must be given an explicit fixed-size number type +// :1:5: error: variable of type 'comptime_int' must be const or comptime +// :1:5: note: to modify this variable at runtime, it must be given an explicit fixed-size number type diff --git a/test/cases/compile_errors/usingnamespace_with_wrong_type.zig b/test/cases/compile_errors/usingnamespace_with_wrong_type.zig index 4ec4bf4838..294fd8c012 100644 --- a/test/cases/compile_errors/usingnamespace_with_wrong_type.zig +++ b/test/cases/compile_errors/usingnamespace_with_wrong_type.zig @@ -4,4 +4,4 @@ usingnamespace void; // backend=stage2 // target=native // -// :1:1: error: type void has no namespace +// :1:16: error: type void has no namespace -- cgit v1.2.3