From 6d8ee89721f742a90d218a621640c9e11633e758 Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Sun, 27 Oct 2024 18:02:12 +0100 Subject: [PATCH] fix compile error tests with unstable error sets The print order of error sets depends on the order that the compiler adds names to its internal state. These names can be anything, and do not necessarily need to be from the same error set or be errors at all. When the last remaining reference to builtin.cpu.arch was removed in start.zig in 9b42bc1ce5, this order changed. Likely there is something that has the name 'C' that is referenced somewhere recursively from builtin.cpu.arch. This all causes these few tests to fail, and hence the expected order is simply updated now. Perhaps there is a better way to add this. --- ...cit_error_set_cast_known_at_comptime_violates_error_sets.zig | 2 +- .../compile_errors/implicit_cast_of_error_set_not_a_subset.zig | 2 +- .../compile_errors/int_to_err_non_global_invalid_number.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/cases/compile_errors/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig b/test/cases/compile_errors/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig index a1beac65f2..0418d327c9 100644 --- a/test/cases/compile_errors/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig +++ b/test/cases/compile_errors/explicit_error_set_cast_known_at_comptime_violates_error_sets.zig @@ -10,4 +10,4 @@ comptime { // backend=stage2 // target=native // -// :5:21: error: 'error.B' not a member of error set 'error{C,A}' +// :5:21: error: 'error.B' not a member of error set 'error{A,C}' diff --git a/test/cases/compile_errors/implicit_cast_of_error_set_not_a_subset.zig b/test/cases/compile_errors/implicit_cast_of_error_set_not_a_subset.zig index 617e638627..1dab9d81c9 100644 --- a/test/cases/compile_errors/implicit_cast_of_error_set_not_a_subset.zig +++ b/test/cases/compile_errors/implicit_cast_of_error_set_not_a_subset.zig @@ -12,5 +12,5 @@ fn foo(set1: Set1) void { // backend=stage2 // target=native // -// :7:21: error: expected type 'error{C,A}', found 'error{A,B}' +// :7:21: error: expected type 'error{A,C}', found 'error{A,B}' // :7:21: note: 'error.B' not a member of destination error set diff --git a/test/cases/compile_errors/int_to_err_non_global_invalid_number.zig b/test/cases/compile_errors/int_to_err_non_global_invalid_number.zig index c9f6c1e2e4..829192ab8d 100644 --- a/test/cases/compile_errors/int_to_err_non_global_invalid_number.zig +++ b/test/cases/compile_errors/int_to_err_non_global_invalid_number.zig @@ -16,4 +16,4 @@ comptime { // backend=llvm // target=native // -// :11:21: error: 'error.B' not a member of error set 'error{C,A}' +// :11:21: error: 'error.B' not a member of error set 'error{A,C}'