From ca12e4f33e9030e5e724aae2f6dda9f2d87dccf6 Mon Sep 17 00:00:00 2001 From: mlugg Date: Mon, 11 Nov 2024 12:05:38 +0000 Subject: [PATCH 1/2] test: remove old-style incremental cases, add a few new incremental cases These cases have been disabled for a while, and we have transitioned to using a compact file format for incremental test cases. I was originally planning to port all of these cases, but the vast majority aren't testing anything interesting, so it wasn't worth the effort. I did look through each one; anything interesting being tested has been extracted into a new case in `test/incremental/`. Two of the new tests are currently failing with the self-hosted ELF linker, and thus are currently only enabled with the C backend. Resolves: #12844 --- ...ding_numbers_at_runtime_and_comptime.0.zig | 10 --- ...ding_numbers_at_runtime_and_comptime.1.zig | 12 ---- ...ding_numbers_at_runtime_and_comptime.2.zig | 13 ---- test/cases/arithmetic_operations.0.zig | 17 ----- test/cases/arithmetic_operations.1.zig | 16 ----- test/cases/arithmetic_operations.2.zig | 16 ----- test/cases/arithmetic_operations.3.zig | 16 ----- test/cases/arithmetic_operations.4.zig | 16 ----- test/cases/arithmetic_operations.5.zig | 15 ----- test/cases/arithmetic_operations.6.zig | 21 ------ test/cases/assert_function.0.zig | 15 ----- test/cases/assert_function.1.zig | 17 ----- test/cases/assert_function.10.zig | 27 -------- test/cases/assert_function.11.zig | 66 ------------------- test/cases/assert_function.12.zig | 47 ------------- test/cases/assert_function.13.zig | 19 ------ test/cases/assert_function.14.zig | 17 ----- test/cases/assert_function.15.zig | 10 --- test/cases/assert_function.16.zig | 11 ---- test/cases/assert_function.17.zig | 12 ---- test/cases/assert_function.18.zig | 20 ------ test/cases/assert_function.2.zig | 21 ------ test/cases/assert_function.3.zig | 22 ------- test/cases/assert_function.4.zig | 15 ----- test/cases/assert_function.5.zig | 19 ------ test/cases/assert_function.6.zig | 9 --- test/cases/assert_function.7.zig | 23 ------- test/cases/assert_function.8.zig | 20 ------ test/cases/assert_function.9.zig | 22 ------- test/cases/binary_operands.0.zig | 9 --- test/cases/binary_operands.1.zig | 9 --- test/cases/binary_operands.10.zig | 14 ---- test/cases/binary_operands.11.zig | 10 --- test/cases/binary_operands.12.zig | 9 --- test/cases/binary_operands.13.zig | 9 --- test/cases/binary_operands.14.zig | 13 ---- test/cases/binary_operands.15.zig | 8 --- test/cases/binary_operands.16.zig | 8 --- test/cases/binary_operands.17.zig | 8 --- test/cases/binary_operands.18.zig | 9 --- test/cases/binary_operands.19.zig | 9 --- test/cases/binary_operands.2.zig | 9 --- test/cases/binary_operands.20.zig | 9 --- test/cases/binary_operands.21.zig | 9 --- test/cases/binary_operands.22.zig | 9 --- test/cases/binary_operands.23.zig | 9 --- test/cases/binary_operands.24.zig | 9 --- test/cases/binary_operands.25.zig | 9 --- test/cases/binary_operands.3.zig | 8 --- test/cases/binary_operands.4.zig | 12 ---- test/cases/binary_operands.5.zig | 8 --- test/cases/binary_operands.6.zig | 9 --- test/cases/binary_operands.7.zig | 9 --- test/cases/binary_operands.8.zig | 8 --- test/cases/binary_operands.9.zig | 13 ---- test/cases/break_continue.0.zig | 9 --- test/cases/break_continue.1.zig | 8 --- test/cases/break_continue.2.zig | 10 --- test/cases/break_continue.3.zig | 10 --- test/cases/catch_at_comptime.0.zig | 11 ---- test/cases/catch_at_comptime.1.zig | 11 ---- test/cases/catch_at_comptime.2.zig | 11 ---- test/cases/catch_at_comptime.3.zig | 10 --- test/cases/catch_at_comptime.4.zig | 10 --- test/cases/compile_log.0.zig | 22 ------- test/cases/compile_log.1.zig | 21 ------ test/cases/comptime_var.0.zig | 14 ---- test/cases/comptime_var.1.zig | 14 ---- test/cases/comptime_var.2.zig | 17 ----- test/cases/comptime_var.3.zig | 10 --- test/cases/comptime_var.4.zig | 9 --- test/cases/comptime_var.5.zig | 16 ----- test/cases/comptime_var.6.zig | 15 ----- test/cases/conditional_branches.0.zig | 23 ------- test/cases/conditional_branches.1.zig | 25 ------- test/cases/conditions.0.zig | 11 ---- test/cases/conditions.1.zig | 12 ---- test/cases/conditions.2.zig | 12 ---- test/cases/conditions.3.zig | 16 ----- test/cases/conditions.4.zig | 15 ----- test/cases/conditions.5.zig | 21 ------ test/cases/double_ampersand.0.zig | 6 -- test/cases/double_ampersand.1.zig | 11 ---- test/cases/double_ampersand.2.zig | 7 -- test/cases/enum_values.0.zig | 18 ----- test/cases/enum_values.1.zig | 25 ------- test/cases/error_unions.0.zig | 16 ----- test/cases/error_unions.1.zig | 9 --- test/cases/error_unions.2.zig | 9 --- test/cases/error_unions.3.zig | 13 ---- test/cases/error_unions.4.zig | 13 ---- test/cases/error_unions.5.zig | 13 ---- test/cases/errors.0.zig | 15 ----- test/cases/errors.1.zig | 18 ----- test/cases/errors.2.zig | 27 -------- test/cases/errors.3.zig | 12 ---- test/cases/extern_variable_has_no_type.0.zig | 10 --- test/cases/extern_variable_has_no_type.1.zig | 8 --- test/cases/function_calls.0.zig | 12 ---- test/cases/function_calls.1.zig | 15 ----- test/cases/function_calls.2.zig | 14 ---- test/cases/function_calls.3.zig | 10 --- test/cases/hello_world_with_updates.0.zig | 6 -- test/cases/hello_world_with_updates.1.zig | 6 -- test/cases/hello_world_with_updates.2.zig | 19 ------ test/cases/hello_world_with_updates.3.zig | 16 ----- test/cases/hello_world_with_updates.4.zig | 22 ------- test/cases/hello_world_with_updates.5.zig | 16 ----- test/cases/hello_world_with_updates.6.zig | 20 ------ test/cases/int_to_ptr.0.zig | 8 --- test/cases/int_to_ptr.1.zig | 7 -- test/cases/locals.0.zig | 14 ---- test/cases/locals.1.zig | 18 ----- test/cases/lower_unnamed_consts_structs.0.zig | 25 ------- test/cases/lower_unnamed_consts_structs.1.zig | 35 ---------- test/cases/lower_unnamed_consts_structs.2.zig | 25 ------- test/cases/merge_error_sets.0.zig | 18 ----- test/cases/merge_error_sets.1.zig | 9 --- ...ying_numbers_at_runtime_and_comptime.0.zig | 11 ---- ...ying_numbers_at_runtime_and_comptime.1.zig | 12 ---- ...ying_numbers_at_runtime_and_comptime.2.zig | 13 ---- .../only_1_function_and_it_gets_updated.0.zig | 7 -- .../only_1_function_and_it_gets_updated.1.zig | 8 --- test/cases/optional_payload.0.zig | 19 ------ test/cases/optional_payload.1.zig | 17 ----- test/cases/optional_payload.2.zig | 18 ----- test/cases/optional_payload.3.zig | 18 ----- test/cases/optionals.0.zig | 13 ---- test/cases/optionals.1.zig | 12 ---- test/cases/optionals.2.zig | 8 --- test/cases/optionals.3.zig | 9 --- test/cases/optionals.4.zig | 13 ---- test/cases/orelse_at_comptime.0.zig | 11 ---- test/cases/orelse_at_comptime.1.zig | 11 ---- test/cases/parameters_and_return_values.0.zig | 20 ------ test/cases/parameters_and_return_values.1.zig | 14 ---- test/cases/pointers.0.zig | 14 ---- test/cases/pointers.1.zig | 18 ----- test/cases/redundant_comptime.0.zig | 7 -- test/cases/redundant_comptime.1.zig | 9 --- test/cases/spilling_registers.0.zig | 38 ----------- test/cases/spilling_registers.1.zig | 37 ----------- test/cases/structs.0.zig | 11 ---- test/cases/structs.1.zig | 10 --- test/cases/structs.2.zig | 10 --- test/cases/structs.3.zig | 13 ---- test/cases/structs.4.zig | 11 ---- test/cases/switch.0.zig | 16 ----- test/cases/switch.1.zig | 16 ----- test/cases/switch.2.zig | 15 ----- test/cases/switch.3.zig | 16 ----- test/cases/type_of.0.zig | 13 ---- test/cases/type_of.1.zig | 11 ---- test/cases/type_of.2.zig | 9 --- test/cases/unused_labels.0.zig | 8 --- test/cases/unused_labels.1.zig | 7 -- test/cases/unused_labels.2.zig | 7 -- test/cases/unused_labels.3.zig | 10 --- test/cases/variable_shadowing.0.zig | 11 ---- test/cases/variable_shadowing.1.zig | 9 --- test/cases/variable_shadowing.10.zig | 9 --- test/cases/variable_shadowing.2.zig | 13 ---- test/cases/variable_shadowing.3.zig | 9 --- test/cases/variable_shadowing.4.zig | 9 --- test/cases/variable_shadowing.5.zig | 9 --- test/cases/variable_shadowing.6.zig | 11 ---- test/cases/variable_shadowing.7.zig | 9 --- test/cases/variable_shadowing.8.zig | 9 --- test/cases/variable_shadowing.9.zig | 9 --- test/cases/while_loops.0.zig | 12 ---- test/cases/while_loops.1.zig | 12 ---- test/cases/while_loops.2.zig | 13 ---- test/cases/x86_64-linux/inline_assembly.0.zig | 16 ----- test/cases/x86_64-linux/inline_assembly.1.zig | 15 ----- test/cases/x86_64-linux/inline_assembly.2.zig | 12 ---- test/cases/x86_64-linux/inline_assembly.3.zig | 12 ---- test/incremental/change_fn_type | 35 ++++++++++ test/incremental/change_struct_same_fields | 50 ++++++++++++++ test/incremental/compile_error_then_log | 21 ++++++ test/incremental/function_becomes_inline | 35 ++++++++++ .../recursive_function_becomes_non_recursive | 28 ++++++++ 181 files changed, 169 insertions(+), 2456 deletions(-) delete mode 100644 test/cases/adding_numbers_at_runtime_and_comptime.0.zig delete mode 100644 test/cases/adding_numbers_at_runtime_and_comptime.1.zig delete mode 100644 test/cases/adding_numbers_at_runtime_and_comptime.2.zig delete mode 100644 test/cases/arithmetic_operations.0.zig delete mode 100644 test/cases/arithmetic_operations.1.zig delete mode 100644 test/cases/arithmetic_operations.2.zig delete mode 100644 test/cases/arithmetic_operations.3.zig delete mode 100644 test/cases/arithmetic_operations.4.zig delete mode 100644 test/cases/arithmetic_operations.5.zig delete mode 100644 test/cases/arithmetic_operations.6.zig delete mode 100644 test/cases/assert_function.0.zig delete mode 100644 test/cases/assert_function.1.zig delete mode 100644 test/cases/assert_function.10.zig delete mode 100644 test/cases/assert_function.11.zig delete mode 100644 test/cases/assert_function.12.zig delete mode 100644 test/cases/assert_function.13.zig delete mode 100644 test/cases/assert_function.14.zig delete mode 100644 test/cases/assert_function.15.zig delete mode 100644 test/cases/assert_function.16.zig delete mode 100644 test/cases/assert_function.17.zig delete mode 100644 test/cases/assert_function.18.zig delete mode 100644 test/cases/assert_function.2.zig delete mode 100644 test/cases/assert_function.3.zig delete mode 100644 test/cases/assert_function.4.zig delete mode 100644 test/cases/assert_function.5.zig delete mode 100644 test/cases/assert_function.6.zig delete mode 100644 test/cases/assert_function.7.zig delete mode 100644 test/cases/assert_function.8.zig delete mode 100644 test/cases/assert_function.9.zig delete mode 100644 test/cases/binary_operands.0.zig delete mode 100644 test/cases/binary_operands.1.zig delete mode 100644 test/cases/binary_operands.10.zig delete mode 100644 test/cases/binary_operands.11.zig delete mode 100644 test/cases/binary_operands.12.zig delete mode 100644 test/cases/binary_operands.13.zig delete mode 100644 test/cases/binary_operands.14.zig delete mode 100644 test/cases/binary_operands.15.zig delete mode 100644 test/cases/binary_operands.16.zig delete mode 100644 test/cases/binary_operands.17.zig delete mode 100644 test/cases/binary_operands.18.zig delete mode 100644 test/cases/binary_operands.19.zig delete mode 100644 test/cases/binary_operands.2.zig delete mode 100644 test/cases/binary_operands.20.zig delete mode 100644 test/cases/binary_operands.21.zig delete mode 100644 test/cases/binary_operands.22.zig delete mode 100644 test/cases/binary_operands.23.zig delete mode 100644 test/cases/binary_operands.24.zig delete mode 100644 test/cases/binary_operands.25.zig delete mode 100644 test/cases/binary_operands.3.zig delete mode 100644 test/cases/binary_operands.4.zig delete mode 100644 test/cases/binary_operands.5.zig delete mode 100644 test/cases/binary_operands.6.zig delete mode 100644 test/cases/binary_operands.7.zig delete mode 100644 test/cases/binary_operands.8.zig delete mode 100644 test/cases/binary_operands.9.zig delete mode 100644 test/cases/break_continue.0.zig delete mode 100644 test/cases/break_continue.1.zig delete mode 100644 test/cases/break_continue.2.zig delete mode 100644 test/cases/break_continue.3.zig delete mode 100644 test/cases/catch_at_comptime.0.zig delete mode 100644 test/cases/catch_at_comptime.1.zig delete mode 100644 test/cases/catch_at_comptime.2.zig delete mode 100644 test/cases/catch_at_comptime.3.zig delete mode 100644 test/cases/catch_at_comptime.4.zig delete mode 100644 test/cases/compile_log.0.zig delete mode 100644 test/cases/compile_log.1.zig delete mode 100644 test/cases/comptime_var.0.zig delete mode 100644 test/cases/comptime_var.1.zig delete mode 100644 test/cases/comptime_var.2.zig delete mode 100644 test/cases/comptime_var.3.zig delete mode 100644 test/cases/comptime_var.4.zig delete mode 100644 test/cases/comptime_var.5.zig delete mode 100644 test/cases/comptime_var.6.zig delete mode 100644 test/cases/conditional_branches.0.zig delete mode 100644 test/cases/conditional_branches.1.zig delete mode 100644 test/cases/conditions.0.zig delete mode 100644 test/cases/conditions.1.zig delete mode 100644 test/cases/conditions.2.zig delete mode 100644 test/cases/conditions.3.zig delete mode 100644 test/cases/conditions.4.zig delete mode 100644 test/cases/conditions.5.zig delete mode 100644 test/cases/double_ampersand.0.zig delete mode 100644 test/cases/double_ampersand.1.zig delete mode 100644 test/cases/double_ampersand.2.zig delete mode 100644 test/cases/enum_values.0.zig delete mode 100644 test/cases/enum_values.1.zig delete mode 100644 test/cases/error_unions.0.zig delete mode 100644 test/cases/error_unions.1.zig delete mode 100644 test/cases/error_unions.2.zig delete mode 100644 test/cases/error_unions.3.zig delete mode 100644 test/cases/error_unions.4.zig delete mode 100644 test/cases/error_unions.5.zig delete mode 100644 test/cases/errors.0.zig delete mode 100644 test/cases/errors.1.zig delete mode 100644 test/cases/errors.2.zig delete mode 100644 test/cases/errors.3.zig delete mode 100644 test/cases/extern_variable_has_no_type.0.zig delete mode 100644 test/cases/extern_variable_has_no_type.1.zig delete mode 100644 test/cases/function_calls.0.zig delete mode 100644 test/cases/function_calls.1.zig delete mode 100644 test/cases/function_calls.2.zig delete mode 100644 test/cases/function_calls.3.zig delete mode 100644 test/cases/hello_world_with_updates.0.zig delete mode 100644 test/cases/hello_world_with_updates.1.zig delete mode 100644 test/cases/hello_world_with_updates.2.zig delete mode 100644 test/cases/hello_world_with_updates.3.zig delete mode 100644 test/cases/hello_world_with_updates.4.zig delete mode 100644 test/cases/hello_world_with_updates.5.zig delete mode 100644 test/cases/hello_world_with_updates.6.zig delete mode 100644 test/cases/int_to_ptr.0.zig delete mode 100644 test/cases/int_to_ptr.1.zig delete mode 100644 test/cases/locals.0.zig delete mode 100644 test/cases/locals.1.zig delete mode 100644 test/cases/lower_unnamed_consts_structs.0.zig delete mode 100644 test/cases/lower_unnamed_consts_structs.1.zig delete mode 100644 test/cases/lower_unnamed_consts_structs.2.zig delete mode 100644 test/cases/merge_error_sets.0.zig delete mode 100644 test/cases/merge_error_sets.1.zig delete mode 100644 test/cases/multiplying_numbers_at_runtime_and_comptime.0.zig delete mode 100644 test/cases/multiplying_numbers_at_runtime_and_comptime.1.zig delete mode 100644 test/cases/multiplying_numbers_at_runtime_and_comptime.2.zig delete mode 100644 test/cases/only_1_function_and_it_gets_updated.0.zig delete mode 100644 test/cases/only_1_function_and_it_gets_updated.1.zig delete mode 100644 test/cases/optional_payload.0.zig delete mode 100644 test/cases/optional_payload.1.zig delete mode 100644 test/cases/optional_payload.2.zig delete mode 100644 test/cases/optional_payload.3.zig delete mode 100644 test/cases/optionals.0.zig delete mode 100644 test/cases/optionals.1.zig delete mode 100644 test/cases/optionals.2.zig delete mode 100644 test/cases/optionals.3.zig delete mode 100644 test/cases/optionals.4.zig delete mode 100644 test/cases/orelse_at_comptime.0.zig delete mode 100644 test/cases/orelse_at_comptime.1.zig delete mode 100644 test/cases/parameters_and_return_values.0.zig delete mode 100644 test/cases/parameters_and_return_values.1.zig delete mode 100644 test/cases/pointers.0.zig delete mode 100644 test/cases/pointers.1.zig delete mode 100644 test/cases/redundant_comptime.0.zig delete mode 100644 test/cases/redundant_comptime.1.zig delete mode 100644 test/cases/spilling_registers.0.zig delete mode 100644 test/cases/spilling_registers.1.zig delete mode 100644 test/cases/structs.0.zig delete mode 100644 test/cases/structs.1.zig delete mode 100644 test/cases/structs.2.zig delete mode 100644 test/cases/structs.3.zig delete mode 100644 test/cases/structs.4.zig delete mode 100644 test/cases/switch.0.zig delete mode 100644 test/cases/switch.1.zig delete mode 100644 test/cases/switch.2.zig delete mode 100644 test/cases/switch.3.zig delete mode 100644 test/cases/type_of.0.zig delete mode 100644 test/cases/type_of.1.zig delete mode 100644 test/cases/type_of.2.zig delete mode 100644 test/cases/unused_labels.0.zig delete mode 100644 test/cases/unused_labels.1.zig delete mode 100644 test/cases/unused_labels.2.zig delete mode 100644 test/cases/unused_labels.3.zig delete mode 100644 test/cases/variable_shadowing.0.zig delete mode 100644 test/cases/variable_shadowing.1.zig delete mode 100644 test/cases/variable_shadowing.10.zig delete mode 100644 test/cases/variable_shadowing.2.zig delete mode 100644 test/cases/variable_shadowing.3.zig delete mode 100644 test/cases/variable_shadowing.4.zig delete mode 100644 test/cases/variable_shadowing.5.zig delete mode 100644 test/cases/variable_shadowing.6.zig delete mode 100644 test/cases/variable_shadowing.7.zig delete mode 100644 test/cases/variable_shadowing.8.zig delete mode 100644 test/cases/variable_shadowing.9.zig delete mode 100644 test/cases/while_loops.0.zig delete mode 100644 test/cases/while_loops.1.zig delete mode 100644 test/cases/while_loops.2.zig delete mode 100644 test/cases/x86_64-linux/inline_assembly.0.zig delete mode 100644 test/cases/x86_64-linux/inline_assembly.1.zig delete mode 100644 test/cases/x86_64-linux/inline_assembly.2.zig delete mode 100644 test/cases/x86_64-linux/inline_assembly.3.zig create mode 100644 test/incremental/change_fn_type create mode 100644 test/incremental/change_struct_same_fields create mode 100644 test/incremental/compile_error_then_log create mode 100644 test/incremental/function_becomes_inline create mode 100644 test/incremental/recursive_function_becomes_non_recursive diff --git a/test/cases/adding_numbers_at_runtime_and_comptime.0.zig b/test/cases/adding_numbers_at_runtime_and_comptime.0.zig deleted file mode 100644 index e8c219681348..000000000000 --- a/test/cases/adding_numbers_at_runtime_and_comptime.0.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - if (a + b != 7) unreachable; -} - -// run -// diff --git a/test/cases/adding_numbers_at_runtime_and_comptime.1.zig b/test/cases/adding_numbers_at_runtime_and_comptime.1.zig deleted file mode 100644 index d90dc6884d69..000000000000 --- a/test/cases/adding_numbers_at_runtime_and_comptime.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - if (x - 7 != 0) unreachable; -} - -fn add(a: u32, b: u32) u32 { - return a + b; -} - -const x = add(3, 4); - -// run -// diff --git a/test/cases/adding_numbers_at_runtime_and_comptime.2.zig b/test/cases/adding_numbers_at_runtime_and_comptime.2.zig deleted file mode 100644 index d6d8755dc3ca..000000000000 --- a/test/cases/adding_numbers_at_runtime_and_comptime.2.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() void { - var x: usize = 3; - _ = &x; - const y = add(1, 2, x); - if (y - 6 != 0) unreachable; -} - -inline fn add(a: usize, b: usize, c: usize) usize { - return a + b + c; -} - -// run -// diff --git a/test/cases/arithmetic_operations.0.zig b/test/cases/arithmetic_operations.0.zig deleted file mode 100644 index ea22e222160f..000000000000 --- a/test/cases/arithmetic_operations.0.zig +++ /dev/null @@ -1,17 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(2, 4); - print(1, 7); -} - -fn print(a: u32, b: u32) void { - const str = "123456789"; - const len = a + b; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// target=x86_64-linux,x86_64-macos -// -// 12345612345678 diff --git a/test/cases/arithmetic_operations.1.zig b/test/cases/arithmetic_operations.1.zig deleted file mode 100644 index 31f77317d535..000000000000 --- a/test/cases/arithmetic_operations.1.zig +++ /dev/null @@ -1,16 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(10, 5); - print(4, 3); -} - -fn print(a: u32, b: u32) void { - const str = "123456789"; - const len = a - b; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// -// 123451 diff --git a/test/cases/arithmetic_operations.2.zig b/test/cases/arithmetic_operations.2.zig deleted file mode 100644 index 4ef5bec8d6bd..000000000000 --- a/test/cases/arithmetic_operations.2.zig +++ /dev/null @@ -1,16 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(8, 9); - print(3, 7); -} - -fn print(a: u32, b: u32) void { - const str = "123456789"; - const len = a & b; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// -// 12345678123 diff --git a/test/cases/arithmetic_operations.3.zig b/test/cases/arithmetic_operations.3.zig deleted file mode 100644 index a16fdbc2d1f5..000000000000 --- a/test/cases/arithmetic_operations.3.zig +++ /dev/null @@ -1,16 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(4, 2); - print(3, 7); -} - -fn print(a: u32, b: u32) void { - const str = "123456789"; - const len = a | b; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// -// 1234561234567 diff --git a/test/cases/arithmetic_operations.4.zig b/test/cases/arithmetic_operations.4.zig deleted file mode 100644 index 5037ad748530..000000000000 --- a/test/cases/arithmetic_operations.4.zig +++ /dev/null @@ -1,16 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(42, 42); - print(3, 5); -} - -fn print(a: u32, b: u32) void { - const str = "123456789"; - const len = a ^ b; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// -// 123456 diff --git a/test/cases/arithmetic_operations.5.zig b/test/cases/arithmetic_operations.5.zig deleted file mode 100644 index b1c18ca7da2f..000000000000 --- a/test/cases/arithmetic_operations.5.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - var x: u32 = 1; - assert(x << 1 == 2); - - x <<= 1; - assert(x << 2 == 8); - assert(x << 3 == 16); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/arithmetic_operations.6.zig b/test/cases/arithmetic_operations.6.zig deleted file mode 100644 index e03731173c61..000000000000 --- a/test/cases/arithmetic_operations.6.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - var a: u32 = 1024; - assert(a >> 1 == 512); - - a >>= 1; - assert(a >> 2 == 128); - assert(a >> 3 == 64); - assert(a >> 4 == 32); - assert(a >> 5 == 16); - assert(a >> 6 == 8); - assert(a >> 7 == 4); - assert(a >> 8 == 2); - assert(a >> 9 == 1); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.0.zig b/test/cases/assert_function.0.zig deleted file mode 100644 index 7a832e522b32..000000000000 --- a/test/cases/assert_function.0.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - assert(a + b == 7); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// target=x86_64-macos,x86_64-linux -// link_libc=true diff --git a/test/cases/assert_function.1.zig b/test/cases/assert_function.1.zig deleted file mode 100644 index ac2df25d8556..000000000000 --- a/test/cases/assert_function.1.zig +++ /dev/null @@ -1,17 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - assert(e == 14); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.10.zig b/test/cases/assert_function.10.zig deleted file mode 100644 index b3f1610cd62b..000000000000 --- a/test/cases/assert_function.10.zig +++ /dev/null @@ -1,27 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 116); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - break :blk j; - }; - const y = x + a; // 113 - const z = y + a; // 116 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.11.zig b/test/cases/assert_function.11.zig deleted file mode 100644 index d64130a6775b..000000000000 --- a/test/cases/assert_function.11.zig +++ /dev/null @@ -1,66 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 1221); - assert(mul(3, 4) == 21609); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = j + k; // 320 - const m = l + c; // 327 - const n = m + d; // 337 - const o = n + e; // 351 - const p = o + f; // 375 - const q = p + g; // 413 - const r = q + h; // 475 - const s = r + i; // 575 - const t = s + j; // 685 - const u = t + k; // 895 - const v = u + l; // 1215 - break :blk v; - }; - const y = x + a; // 1218 - const z = y + a; // 1221 - return z; -} - -fn mul(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a * a * a * a; // 81 - const d = a * a * a * b; // 108 - const e = a * a * b * a; // 108 - const f = a * a * b * b; // 144 - const g = a * b * a * a; // 108 - const h = a * b * a * b; // 144 - const i = a * b * b * a; // 144 - const j = a * b * b * b; // 192 - const k = b * a * a * a; // 108 - const l = b * a * a * b; // 144 - const m = b * a * b * a; // 144 - const n = b * a * b * b; // 192 - const o = b * b * a * a; // 144 - const p = b * b * a * b; // 192 - const q = b * b * b * a; // 192 - const r = b * b * b * b; // 256 - const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401 - break :blk s; - }; - const y = x * a; // 7203 - const z = y * a; // 21609 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.12.zig b/test/cases/assert_function.12.zig deleted file mode 100644 index 4f64c1e06268..000000000000 --- a/test/cases/assert_function.12.zig +++ /dev/null @@ -1,47 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 791); - assert(add(4, 3) == 79); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = if (a < b) blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = k + c; // 217 - const m = l + d; // 227 - const n = m + e; // 241 - const o = n + f; // 265 - const p = o + g; // 303 - const q = p + h; // 365 - const r = q + i; // 465 - const s = r + j; // 575 - const t = s + k; // 785 - break :blk t; - } else blk: { - const t = b + b + a; // 10 - const c = a + t; // 14 - const d = c + t; // 24 - const e = d + t; // 34 - const f = e + t; // 44 - const g = f + t; // 54 - const h = c + g; // 68 - break :blk h + b; // 71 - }; - const y = x + a; // 788, 75 - const z = y + a; // 791, 79 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.13.zig b/test/cases/assert_function.13.zig deleted file mode 100644 index 240abf0108db..000000000000 --- a/test/cases/assert_function.13.zig +++ /dev/null @@ -1,19 +0,0 @@ -pub fn main() void { - const ignore = - \\ cool thx - \\ - ; - _ = ignore; - add('ぁ', '\x03'); -} - -fn add(a: u32, b: u32) void { - assert(a + b == 12356); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.14.zig b/test/cases/assert_function.14.zig deleted file mode 100644 index d25100dccee2..000000000000 --- a/test/cases/assert_function.14.zig +++ /dev/null @@ -1,17 +0,0 @@ -pub fn main() void { - add(aa, bb); -} - -const aa = 'ぁ'; -const bb = '\x03'; - -fn add(a: u32, b: u32) void { - assert(a + b == 12356); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.15.zig b/test/cases/assert_function.15.zig deleted file mode 100644 index 33ae1ed5af12..000000000000 --- a/test/cases/assert_function.15.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - assert("hello"[0] == 'h'); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.16.zig b/test/cases/assert_function.16.zig deleted file mode 100644 index eef113642324..000000000000 --- a/test/cases/assert_function.16.zig +++ /dev/null @@ -1,11 +0,0 @@ -const hello = "hello".*; -pub fn main() void { - assert(hello[1] == 'e'); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.17.zig b/test/cases/assert_function.17.zig deleted file mode 100644 index 01c4a5ca3cbe..000000000000 --- a/test/cases/assert_function.17.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - var i: u64 = 0xFFEEDDCCBBAA9988; - _ = &i; - assert(i == 0xFFEEDDCCBBAA9988); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.18.zig b/test/cases/assert_function.18.zig deleted file mode 100644 index ac0f97c40f89..000000000000 --- a/test/cases/assert_function.18.zig +++ /dev/null @@ -1,20 +0,0 @@ -const builtin = @import("builtin"); - -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - for ("hello") |_| print(); -} - -fn print() void { - _ = write(1, @intFromPtr("hello\n"), 6); -} - -// run -// -// hello -// hello -// hello -// hello -// hello -// diff --git a/test/cases/assert_function.2.zig b/test/cases/assert_function.2.zig deleted file mode 100644 index 8c1c51048618..000000000000 --- a/test/cases/assert_function.2.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - assert(i == 100); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.3.zig b/test/cases/assert_function.3.zig deleted file mode 100644 index a6829f8e0239..000000000000 --- a/test/cases/assert_function.3.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - assert(j == 110); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.4.zig b/test/cases/assert_function.4.zig deleted file mode 100644 index 69df4354c3eb..000000000000 --- a/test/cases/assert_function.4.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 7); - assert(add(20, 10) == 30); -} - -fn add(a: u32, b: u32) u32 { - return a + b; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.5.zig b/test/cases/assert_function.5.zig deleted file mode 100644 index 89f3f7df4fd3..000000000000 --- a/test/cases/assert_function.5.zig +++ /dev/null @@ -1,19 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 7); - assert(add(20, 10) == 30); -} - -fn add(a: u32, b: u32) u32 { - var x: u32 = undefined; - x = 0; - x += a; - x += b; - return x; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/assert_function.6.zig b/test/cases/assert_function.6.zig deleted file mode 100644 index 1b1b75e68ea7..000000000000 --- a/test/cases/assert_function.6.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - const a: u32 = 2; - const b: ?u32 = a; - const c = b.?; - if (c != 2) unreachable; -} - -// run -// diff --git a/test/cases/assert_function.7.zig b/test/cases/assert_function.7.zig deleted file mode 100644 index 9db604d3b9c0..000000000000 --- a/test/cases/assert_function.7.zig +++ /dev/null @@ -1,23 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - var i: u32 = 0; - while (i < 4) : (i += 1) print(); - assert(i == 4); -} - -fn print() void { - _ = write(1, @intFromPtr("hello\n"), 6); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// -// hello -// hello -// hello -// hello -// diff --git a/test/cases/assert_function.8.zig b/test/cases/assert_function.8.zig deleted file mode 100644 index 02b486a8cb2b..000000000000 --- a/test/cases/assert_function.8.zig +++ /dev/null @@ -1,20 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - var i: u32 = 0; - inline while (i < 4) : (i += 1) print(); - assert(i == 4); -} - -fn print() void { - _ = write(1, @intFromPtr("hello\n"), 6); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// error -// -// :5:21: error: unable to resolve comptime value -// :5:21: note: condition in comptime branch must be comptime-known diff --git a/test/cases/assert_function.9.zig b/test/cases/assert_function.9.zig deleted file mode 100644 index c754bb771133..000000000000 --- a/test/cases/assert_function.9.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 20); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - break :blk e; - }; - const y = x + a; // 17 - const z = y + a; // 20 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/binary_operands.0.zig b/test/cases/binary_operands.0.zig deleted file mode 100644 index e3688232aa27..000000000000 --- a/test/cases/binary_operands.0.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: u8 = 5; - i += 20; - if (i != 25) unreachable; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/binary_operands.1.zig b/test/cases/binary_operands.1.zig deleted file mode 100644 index 2b244b194a8b..000000000000 --- a/test/cases/binary_operands.1.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: i32 = 2147483647; - _ = &i; - if (i +% 1 != -2147483648) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.10.zig b/test/cases/binary_operands.10.zig deleted file mode 100644 index 721a9217437b..000000000000 --- a/test/cases/binary_operands.10.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - var i: u32 = 5; - i *= 7; - var result: u32 = foo(i, 10); - _ = &result; - if (result != 350) unreachable; - return; -} -fn foo(x: u32, y: u32) u32 { - return x * y; -} - -// run -// diff --git a/test/cases/binary_operands.11.zig b/test/cases/binary_operands.11.zig deleted file mode 100644 index f6a875517818..000000000000 --- a/test/cases/binary_operands.11.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - var i: i32 = 2147483647; - _ = &i; - const result = i *% 2; - if (result != -2) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.12.zig b/test/cases/binary_operands.12.zig deleted file mode 100644 index d8b369764fb3..000000000000 --- a/test/cases/binary_operands.12.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: u3 = 3; - _ = &i; - if (i *% 3 != 1) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.13.zig b/test/cases/binary_operands.13.zig deleted file mode 100644 index 680d82a91985..000000000000 --- a/test/cases/binary_operands.13.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: i4 = 3; - _ = &i; - if (i *% 3 != -7) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.14.zig b/test/cases/binary_operands.14.zig deleted file mode 100644 index aa1d62bcde45..000000000000 --- a/test/cases/binary_operands.14.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() void { - var i: u32 = 352; - i /= 7; // i = 50 - const result: u32 = foo(i, 7); - if (result != 7) unreachable; - return; -} -fn foo(x: u32, y: u32) u32 { - return x / y; -} - -// run -// diff --git a/test/cases/binary_operands.15.zig b/test/cases/binary_operands.15.zig deleted file mode 100644 index c709e5dfd232..000000000000 --- a/test/cases/binary_operands.15.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - i &= 6; - return i - 4; -} - -// run -// diff --git a/test/cases/binary_operands.16.zig b/test/cases/binary_operands.16.zig deleted file mode 100644 index fe1813b87727..000000000000 --- a/test/cases/binary_operands.16.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - i |= 6; - return i - 7; -} - -// run -// diff --git a/test/cases/binary_operands.17.zig b/test/cases/binary_operands.17.zig deleted file mode 100644 index 439d3d6d6b59..000000000000 --- a/test/cases/binary_operands.17.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - i ^= 6; - return i - 3; -} - -// run -// diff --git a/test/cases/binary_operands.18.zig b/test/cases/binary_operands.18.zig deleted file mode 100644 index c21aa586c555..000000000000 --- a/test/cases/binary_operands.18.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = false; - b = b or false; - if (b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.19.zig b/test/cases/binary_operands.19.zig deleted file mode 100644 index e95470391cf1..000000000000 --- a/test/cases/binary_operands.19.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = true; - b = b or false; - if (!b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.2.zig b/test/cases/binary_operands.2.zig deleted file mode 100644 index 5b08fecc0448..000000000000 --- a/test/cases/binary_operands.2.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: i4 = 7; - _ = &i; - if (i +% 1 != -8) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.20.zig b/test/cases/binary_operands.20.zig deleted file mode 100644 index 9238bf97c04e..000000000000 --- a/test/cases/binary_operands.20.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = false; - b = b or true; - if (!b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.21.zig b/test/cases/binary_operands.21.zig deleted file mode 100644 index a2d427bda9d6..000000000000 --- a/test/cases/binary_operands.21.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = true; - b = b or true; - if (!b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.22.zig b/test/cases/binary_operands.22.zig deleted file mode 100644 index aa8439a36189..000000000000 --- a/test/cases/binary_operands.22.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = false; - b = b and false; - if (b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.23.zig b/test/cases/binary_operands.23.zig deleted file mode 100644 index 8596ea770980..000000000000 --- a/test/cases/binary_operands.23.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = true; - b = b and false; - if (b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.24.zig b/test/cases/binary_operands.24.zig deleted file mode 100644 index 08dc4430a229..000000000000 --- a/test/cases/binary_operands.24.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = false; - b = b and true; - if (b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.25.zig b/test/cases/binary_operands.25.zig deleted file mode 100644 index 8aa0acfdb558..000000000000 --- a/test/cases/binary_operands.25.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var b: bool = true; - b = b and true; - if (!b) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.3.zig b/test/cases/binary_operands.3.zig deleted file mode 100644 index 75d78d522a6d..000000000000 --- a/test/cases/binary_operands.3.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var i: u8 = 255; - _ = &i; - return i +% 1; -} - -// run -// diff --git a/test/cases/binary_operands.4.zig b/test/cases/binary_operands.4.zig deleted file mode 100644 index b3fd9fc289ae..000000000000 --- a/test/cases/binary_operands.4.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - i += 20; - const result: u8 = foo(i, 10); - return result - 35; -} -fn foo(x: u8, y: u8) u8 { - return x + y; -} - -// run -// diff --git a/test/cases/binary_operands.5.zig b/test/cases/binary_operands.5.zig deleted file mode 100644 index 51ab43747568..000000000000 --- a/test/cases/binary_operands.5.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var i: u8 = 20; - i -= 5; - return i - 15; -} - -// run -// diff --git a/test/cases/binary_operands.6.zig b/test/cases/binary_operands.6.zig deleted file mode 100644 index b6e04e609e57..000000000000 --- a/test/cases/binary_operands.6.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: i32 = -2147483648; - _ = &i; - if (i -% 1 != 2147483647) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.7.zig b/test/cases/binary_operands.7.zig deleted file mode 100644 index ae69df2c5509..000000000000 --- a/test/cases/binary_operands.7.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i: i7 = -64; - _ = &i; - if (i -% 1 != 63) unreachable; - return; -} - -// run -// diff --git a/test/cases/binary_operands.8.zig b/test/cases/binary_operands.8.zig deleted file mode 100644 index fb2741cab6d9..000000000000 --- a/test/cases/binary_operands.8.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() void { - var i: u4 = 0; - _ = &i; - if (i -% 1 != 15) unreachable; -} - -// run -// diff --git a/test/cases/binary_operands.9.zig b/test/cases/binary_operands.9.zig deleted file mode 100644 index a9d62b96e340..000000000000 --- a/test/cases/binary_operands.9.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - i -= 3; - var result: u8 = foo(i, 10); - _ = &result; - return result - 8; -} -fn foo(x: u8, y: u8) u8 { - return y - x; -} - -// run -// diff --git a/test/cases/break_continue.0.zig b/test/cases/break_continue.0.zig deleted file mode 100644 index 6684bcb0d09e..000000000000 --- a/test/cases/break_continue.0.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - while (true) { - break; - } -} - -// run -// target=x86_64-linux,x86_64-macos -// diff --git a/test/cases/break_continue.1.zig b/test/cases/break_continue.1.zig deleted file mode 100644 index 9e4f79bd14d7..000000000000 --- a/test/cases/break_continue.1.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() void { - foo: while (true) { - break :foo; - } -} - -// run -// diff --git a/test/cases/break_continue.2.zig b/test/cases/break_continue.2.zig deleted file mode 100644 index ba12f33e3f05..000000000000 --- a/test/cases/break_continue.2.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - var i: u64 = 0; - while (true) : (i += 1) { - if (i == 4) return; - continue; - } -} - -// run -// diff --git a/test/cases/break_continue.3.zig b/test/cases/break_continue.3.zig deleted file mode 100644 index 03e224d26545..000000000000 --- a/test/cases/break_continue.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - var i: u64 = 0; - foo: while (true) : (i += 1) { - if (i == 4) return; - continue :foo; - } -} - -// run -// diff --git a/test/cases/catch_at_comptime.0.zig b/test/cases/catch_at_comptime.0.zig deleted file mode 100644 index af1545832dee..000000000000 --- a/test/cases/catch_at_comptime.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const i: anyerror!u64 = 0; - const caught = i catch 5; - assert(caught == 0); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/catch_at_comptime.1.zig b/test/cases/catch_at_comptime.1.zig deleted file mode 100644 index e05caeae6d9f..000000000000 --- a/test/cases/catch_at_comptime.1.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const i: anyerror!u64 = error.B; - const caught = i catch 5; - assert(caught == 5); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/catch_at_comptime.2.zig b/test/cases/catch_at_comptime.2.zig deleted file mode 100644 index 326e6f0b61a4..000000000000 --- a/test/cases/catch_at_comptime.2.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const a: anyerror!comptime_int = 42; - const b: *const comptime_int = &(a catch unreachable); - assert(b.* == 42); -} -fn assert(b: bool) void { - if (!b) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/catch_at_comptime.3.zig b/test/cases/catch_at_comptime.3.zig deleted file mode 100644 index d00317f69742..000000000000 --- a/test/cases/catch_at_comptime.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - const a: anyerror!u32 = error.B; - _ = &(a catch |err| assert(err == error.B)); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/catch_at_comptime.4.zig b/test/cases/catch_at_comptime.4.zig deleted file mode 100644 index 57cb602641de..000000000000 --- a/test/cases/catch_at_comptime.4.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - const a: anyerror!u32 = error.Bar; - a catch |err| assert(err == error.Bar); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/compile_log.0.zig b/test/cases/compile_log.0.zig deleted file mode 100644 index 07b7c715511a..000000000000 --- a/test/cases/compile_log.0.zig +++ /dev/null @@ -1,22 +0,0 @@ -export fn _start() noreturn { - const b = true; - var f: u32 = 1; - @compileLog(b, 20, f, x); - @compileLog(1000); - var bruh: usize = true; - _ = .{ &f, &bruh }; - unreachable; -} -export fn other() void { - @compileLog(1234); -} -fn x() void {} - -// error -// -// :6:23: error: expected type 'usize', found 'bool' -// -// Compile Log Output: -// @as(bool, true), @as(comptime_int, 20), @as(u32, [runtime value]), @as(fn () void, (function 'x')) -// @as(comptime_int, 1000) -// @as(comptime_int, 1234) diff --git a/test/cases/compile_log.1.zig b/test/cases/compile_log.1.zig deleted file mode 100644 index fa3e93bfbf1e..000000000000 --- a/test/cases/compile_log.1.zig +++ /dev/null @@ -1,21 +0,0 @@ -export fn _start() noreturn { - const b = true; - var f: u32 = 1; - _ = &f; - @compileLog(b, 20, f, x); - @compileLog(1000); - unreachable; -} -export fn other() void { - @compileLog(1234); -} -fn x() void {} - -// error -// -// :9:5: error: found compile log statement -// :4:5: note: also here -// -// Compile Log Output: -// @as(bool, true), @as(comptime_int, 20), @as(u32, [runtime value]), @as(fn () void, (function 'x')) -// @as(comptime_int, 1000) diff --git a/test/cases/comptime_var.0.zig b/test/cases/comptime_var.0.zig deleted file mode 100644 index 7044e0fb2a93..000000000000 --- a/test/cases/comptime_var.0.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - _ = &a; - comptime var b: u32 = 0; - if (a == 0) b = 3; -} - -// error -// output_mode=Exe -// target=x86_64-macos,x86_64-linux -// link_libc=true -// -// :5:19: error: store to comptime variable depends on runtime condition -// :5:11: note: runtime condition here diff --git a/test/cases/comptime_var.1.zig b/test/cases/comptime_var.1.zig deleted file mode 100644 index d914ab45b54f..000000000000 --- a/test/cases/comptime_var.1.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - _ = &a; - comptime var b: u32 = 0; - switch (a) { - 0 => {}, - else => b = 3, - } -} - -// error -// -// :6:19: error: store to comptime variable depends on runtime condition -// :4:13: note: runtime condition here diff --git a/test/cases/comptime_var.2.zig b/test/cases/comptime_var.2.zig deleted file mode 100644 index 2d717cb802b2..000000000000 --- a/test/cases/comptime_var.2.zig +++ /dev/null @@ -1,17 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - comptime var len: u32 = 5; - print(len); - len += 9; - print(len); -} - -fn print(len: usize) void { - _ = write(1, @intFromPtr("Hello, World!\n"), len); -} - -// run -// -// HelloHello, World! -// diff --git a/test/cases/comptime_var.3.zig b/test/cases/comptime_var.3.zig deleted file mode 100644 index 5d25d6556e4f..000000000000 --- a/test/cases/comptime_var.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var x: i32 = 1; - x += 1; - if (x != 1) unreachable; -} -pub fn main() void {} - -// error -// -// :4:17: error: reached unreachable code diff --git a/test/cases/comptime_var.4.zig b/test/cases/comptime_var.4.zig deleted file mode 100644 index 74da6ef448ed..000000000000 --- a/test/cases/comptime_var.4.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - comptime var i: u64 = 0; - while (i < 5) : (i += 1) {} -} - -// error -// -// :3:24: error: cannot store to comptime variable in non-inline loop -// :3:5: note: non-inline loop here diff --git a/test/cases/comptime_var.5.zig b/test/cases/comptime_var.5.zig deleted file mode 100644 index bd3d878fa7e6..000000000000 --- a/test/cases/comptime_var.5.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - _ = &a; - if (a == 0) { - comptime var b: u32 = 0; - b = 1; - } -} -comptime { - var x: i32 = 1; - x += 1; - if (x != 2) unreachable; -} - -// run -// diff --git a/test/cases/comptime_var.6.zig b/test/cases/comptime_var.6.zig deleted file mode 100644 index d4e96106bb1b..000000000000 --- a/test/cases/comptime_var.6.zig +++ /dev/null @@ -1,15 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - comptime var i: u64 = 2; - inline while (i < 6) : (i += 1) { - print(i); - } -} -fn print(len: usize) void { - _ = write(1, @intFromPtr("Hello"), len); -} - -// run -// -// HeHelHellHello diff --git a/test/cases/conditional_branches.0.zig b/test/cases/conditional_branches.0.zig deleted file mode 100644 index d1fce95b2cd9..000000000000 --- a/test/cases/conditional_branches.0.zig +++ /dev/null @@ -1,23 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - foo(123); -} - -fn foo(x: u64) void { - if (x > 42) { - print(); - } -} - -fn print() void { - const str = "Hello, World!\n"; - _ = write(1, @intFromPtr(str.ptr), ptr.len); -} - -// run -// target=x86_64-linux,x86_64-macos -// link_libc=true -// -// Hello, World! -// diff --git a/test/cases/conditional_branches.1.zig b/test/cases/conditional_branches.1.zig deleted file mode 100644 index f402cd3bd499..000000000000 --- a/test/cases/conditional_branches.1.zig +++ /dev/null @@ -1,25 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - foo(true); -} - -fn foo(x: bool) void { - if (x) { - print(); - print(); - } else { - print(); - } -} - -fn print() void { - const str = "Hello, World!\n"; - _ = write(1, @intFromPtr(str.ptr), ptr.len); -} - -// run -// -// Hello, World! -// Hello, World! -// diff --git a/test/cases/conditions.0.zig b/test/cases/conditions.0.zig deleted file mode 100644 index 1167ea85a441..000000000000 --- a/test/cases/conditions.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - if (i > @as(u8, 4)) { - i += 10; - } - return i - 15; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/conditions.1.zig b/test/cases/conditions.1.zig deleted file mode 100644 index f9f03808b97a..000000000000 --- a/test/cases/conditions.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - if (i < @as(u8, 4)) { - i += 10; - } else { - i = 2; - } - return i - 2; -} - -// run -// diff --git a/test/cases/conditions.2.zig b/test/cases/conditions.2.zig deleted file mode 100644 index a80ead9ea540..000000000000 --- a/test/cases/conditions.2.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var i: u8 = 5; - if (i < @as(u8, 4)) { - i += 10; - } else if (i == @as(u8, 5)) { - i = 20; - } - return i - 20; -} - -// run -// diff --git a/test/cases/conditions.3.zig b/test/cases/conditions.3.zig deleted file mode 100644 index bd016a47f3c7..000000000000 --- a/test/cases/conditions.3.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() u8 { - var i: u8 = 11; - if (i < @as(u8, 4)) { - i += 10; - } else { - if (i > @as(u8, 10)) { - i += 20; - } else { - i = 20; - } - } - return i - 31; -} - -// run -// diff --git a/test/cases/conditions.4.zig b/test/cases/conditions.4.zig deleted file mode 100644 index e1bd9ce0f7b6..000000000000 --- a/test/cases/conditions.4.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - assert(foo(true) != @as(i32, 30)); -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -fn foo(ok: bool) i32 { - const x = if (ok) @as(i32, 20) else @as(i32, 10); - return x; -} - -// run -// diff --git a/test/cases/conditions.5.zig b/test/cases/conditions.5.zig deleted file mode 100644 index 9b2dfdb58e26..000000000000 --- a/test/cases/conditions.5.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - assert(foo(false) == @as(i32, 20)); - assert(foo(true) == @as(i32, 30)); -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -fn foo(ok: bool) i32 { - const val: i32 = blk: { - var x: i32 = 1; - _ = &x; - if (!ok) break :blk x + @as(i32, 9); - break :blk x + @as(i32, 19); - }; - return val + 10; -} - -// run -// diff --git a/test/cases/double_ampersand.0.zig b/test/cases/double_ampersand.0.zig deleted file mode 100644 index b14c30ecb012..000000000000 --- a/test/cases/double_ampersand.0.zig +++ /dev/null @@ -1,6 +0,0 @@ -pub const a = if (true && false) 1 else 2; - -// error -// output_mode=Exe -// -// :1:24: error: ambiguous use of '&&'; use 'and' for logical AND, or change whitespace to ' & &' for bitwise AND diff --git a/test/cases/double_ampersand.1.zig b/test/cases/double_ampersand.1.zig deleted file mode 100644 index cd5bba02fdaa..000000000000 --- a/test/cases/double_ampersand.1.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const a = true; - const b = false; - _ = a & &b; -} - -// error -// -// :4:11: error: incompatible types: 'bool' and '*const bool' -// :4:9: note: type 'bool' here -// :4:13: note: type '*const bool' here diff --git a/test/cases/double_ampersand.2.zig b/test/cases/double_ampersand.2.zig deleted file mode 100644 index c6f461d66126..000000000000 --- a/test/cases/double_ampersand.2.zig +++ /dev/null @@ -1,7 +0,0 @@ -pub fn main() void { - const b: u8 = 1; - _ = &&b; -} - -// run -// diff --git a/test/cases/enum_values.0.zig b/test/cases/enum_values.0.zig deleted file mode 100644 index 3e4ee609251a..000000000000 --- a/test/cases/enum_values.0.zig +++ /dev/null @@ -1,18 +0,0 @@ -const Number = enum { One, Two, Three }; - -pub fn main() void { - var number1 = Number.One; - var number2: Number = .Two; - if (false) { - &number1; - &number2; - } - const number3: Number = @enumFromInt(2); - if (@intFromEnum(number3) != 2) { - unreachable; - } - return; -} - -// run -// diff --git a/test/cases/enum_values.1.zig b/test/cases/enum_values.1.zig deleted file mode 100644 index 7679a8736181..000000000000 --- a/test/cases/enum_values.1.zig +++ /dev/null @@ -1,25 +0,0 @@ -const Number = enum { One, Two, Three }; - -pub fn main() void { - var number1 = Number.One; - _ = &number1; - var number2: Number = .Two; - _ = &number2; - const number3: Number = @enumFromInt(2); - assert(number1 != number2); - assert(number2 != number3); - assert(@intFromEnum(number1) == 0); - assert(@intFromEnum(number2) == 1); - assert(@intFromEnum(number3) == 2); - var x: Number = .Two; - _ = &x; - assert(number2 == x); - - return; -} -fn assert(val: bool) void { - if (!val) unreachable; -} - -// run -// diff --git a/test/cases/error_unions.0.zig b/test/cases/error_unions.0.zig deleted file mode 100644 index 89646e468105..000000000000 --- a/test/cases/error_unions.0.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() void { - var e1 = error.Foo; - var e2 = error.Bar; - _ = .{ &e1, &e2 }; - assert(e1 != e2); - assert(e1 == error.Foo); - assert(e2 == error.Bar); -} - -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/error_unions.1.zig b/test/cases/error_unions.1.zig deleted file mode 100644 index 792bc88412c6..000000000000 --- a/test/cases/error_unions.1.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() u8 { - var e: anyerror!u8 = 5; - _ = &e; - const i = e catch 10; - return i - 5; -} - -// run -// diff --git a/test/cases/error_unions.2.zig b/test/cases/error_unions.2.zig deleted file mode 100644 index cc61263aa7d6..000000000000 --- a/test/cases/error_unions.2.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() u8 { - var e: anyerror!u8 = error.Foo; - _ = &e; - const i = e catch 10; - return i - 10; -} - -// run -// diff --git a/test/cases/error_unions.3.zig b/test/cases/error_unions.3.zig deleted file mode 100644 index 2661e3bc1921..000000000000 --- a/test/cases/error_unions.3.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var e = foo(); - _ = &e; - const i = e catch 69; - return i - 5; -} - -fn foo() anyerror!u8 { - return 5; -} - -// run -// diff --git a/test/cases/error_unions.4.zig b/test/cases/error_unions.4.zig deleted file mode 100644 index d6d121e1d6c2..000000000000 --- a/test/cases/error_unions.4.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var e = foo(); - _ = &e; - const i = e catch 69; - return i - 69; -} - -fn foo() anyerror!u8 { - return error.Bruh; -} - -// run -// diff --git a/test/cases/error_unions.5.zig b/test/cases/error_unions.5.zig deleted file mode 100644 index 0204cef9265b..000000000000 --- a/test/cases/error_unions.5.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var e = foo(); - _ = &e; - const i = e catch 42; - return i - 42; -} - -fn foo() anyerror!u8 { - return error.Dab; -} - -// run -// diff --git a/test/cases/errors.0.zig b/test/cases/errors.0.zig deleted file mode 100644 index f61ebc42b7bc..000000000000 --- a/test/cases/errors.0.zig +++ /dev/null @@ -1,15 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - foo() catch print(); -} - -fn foo() anyerror!void {} - -fn print() void { - _ = std.posix.write(1, "Hello, World!\n") catch {}; -} - -// run -// target=x86_64-macos -// diff --git a/test/cases/errors.1.zig b/test/cases/errors.1.zig deleted file mode 100644 index ead3262f8420..000000000000 --- a/test/cases/errors.1.zig +++ /dev/null @@ -1,18 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - foo() catch print(); -} - -fn foo() anyerror!void { - return error.Test; -} - -fn print() void { - _ = std.posix.write(1, "Hello, World!\n") catch {}; -} - -// run -// -// Hello, World! -// diff --git a/test/cases/errors.2.zig b/test/cases/errors.2.zig deleted file mode 100644 index a1b9aef97dc4..000000000000 --- a/test/cases/errors.2.zig +++ /dev/null @@ -1,27 +0,0 @@ -pub fn main() void { - foo() catch |err| { - assert(err == error.Foo); - assert(err != error.Bar); - assert(err != error.Baz); - }; - bar() catch |err| { - assert(err != error.Foo); - assert(err == error.Bar); - assert(err != error.Baz); - }; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -fn foo() anyerror!void { - return error.Foo; -} - -fn bar() anyerror!void { - return error.Bar; -} - -// run -// diff --git a/test/cases/errors.3.zig b/test/cases/errors.3.zig deleted file mode 100644 index 390696fcfcb2..000000000000 --- a/test/cases/errors.3.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - foo() catch unreachable; -} - -fn foo() anyerror!void { - try bar(); -} - -fn bar() anyerror!void {} - -// run -// diff --git a/test/cases/extern_variable_has_no_type.0.zig b/test/cases/extern_variable_has_no_type.0.zig deleted file mode 100644 index e141551828fd..000000000000 --- a/test/cases/extern_variable_has_no_type.0.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - const x = foo + foo; - _ = x; -} -extern var foo: i32; - -// error -// -// :2:19: error: unable to evaluate comptime expression -// :2:15: note: operation is runtime due to this operand diff --git a/test/cases/extern_variable_has_no_type.1.zig b/test/cases/extern_variable_has_no_type.1.zig deleted file mode 100644 index f5c31244e5a7..000000000000 --- a/test/cases/extern_variable_has_no_type.1.zig +++ /dev/null @@ -1,8 +0,0 @@ -export fn entry() void { - _ = foo; -} -extern var foo; - -// error -// -// :4:8: error: unable to infer variable type diff --git a/test/cases/function_calls.0.zig b/test/cases/function_calls.0.zig deleted file mode 100644 index eb388bc49f6b..000000000000 --- a/test/cases/function_calls.0.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - foo(); - bar(); -} -fn foo() void { - bar(); - bar(); -} -fn bar() void {} - -// run -// diff --git a/test/cases/function_calls.1.zig b/test/cases/function_calls.1.zig deleted file mode 100644 index 60bc061bca50..000000000000 --- a/test/cases/function_calls.1.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - bar(); - foo(); - foo(); - bar(); - foo(); - bar(); -} -fn foo() void { - bar(); -} -fn bar() void {} - -// run -// diff --git a/test/cases/function_calls.2.zig b/test/cases/function_calls.2.zig deleted file mode 100644 index ce5627378a89..000000000000 --- a/test/cases/function_calls.2.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - bar(); - foo(); - return; -} -fn foo() void { - bar(); - bar(); - bar(); -} -fn bar() void {} - -// run -// diff --git a/test/cases/function_calls.3.zig b/test/cases/function_calls.3.zig deleted file mode 100644 index 0316d9042d6b..000000000000 --- a/test/cases/function_calls.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - foo(10, 20); -} -fn foo(x: u8, y: u8) void { - _ = x; - _ = y; -} - -// run -// diff --git a/test/cases/hello_world_with_updates.0.zig b/test/cases/hello_world_with_updates.0.zig deleted file mode 100644 index 2cebc2c047d4..000000000000 --- a/test/cases/hello_world_with_updates.0.zig +++ /dev/null @@ -1,6 +0,0 @@ -// error -// output_mode=Exe -// target=x86_64-linux,x86_64-macos -// link_libc=true -// -// :?:?: error: root source file struct 'tmp' has no member named 'main' diff --git a/test/cases/hello_world_with_updates.1.zig b/test/cases/hello_world_with_updates.1.zig deleted file mode 100644 index dcf18bbf8771..000000000000 --- a/test/cases/hello_world_with_updates.1.zig +++ /dev/null @@ -1,6 +0,0 @@ -pub export fn main() noreturn {} - -// error -// -// :1:22: error: function declared 'noreturn' implicitly returns -// :1:32: note: control flow reaches end of body here diff --git a/test/cases/hello_world_with_updates.2.zig b/test/cases/hello_world_with_updates.2.zig deleted file mode 100644 index db5564e3a703..000000000000 --- a/test/cases/hello_world_with_updates.2.zig +++ /dev/null @@ -1,19 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; -extern "c" fn exit(c_int) noreturn; - -pub export fn main() noreturn { - print(); - - exit(0); -} - -fn print() void { - const msg = @intFromPtr("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// diff --git a/test/cases/hello_world_with_updates.3.zig b/test/cases/hello_world_with_updates.3.zig deleted file mode 100644 index 8c57d52924b2..000000000000 --- a/test/cases/hello_world_with_updates.3.zig +++ /dev/null @@ -1,16 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - print(); -} - -fn print() void { - const msg = @intFromPtr("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// diff --git a/test/cases/hello_world_with_updates.4.zig b/test/cases/hello_world_with_updates.4.zig deleted file mode 100644 index 54641a3ad5b9..000000000000 --- a/test/cases/hello_world_with_updates.4.zig +++ /dev/null @@ -1,22 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - print(); - print(); - print(); - print(); -} - -fn print() void { - const msg = @intFromPtr("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// Hello, World! -// Hello, World! -// Hello, World! -// diff --git a/test/cases/hello_world_with_updates.5.zig b/test/cases/hello_world_with_updates.5.zig deleted file mode 100644 index ae57d9b7b671..000000000000 --- a/test/cases/hello_world_with_updates.5.zig +++ /dev/null @@ -1,16 +0,0 @@ -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - print(); -} - -fn print() void { - const msg = @intFromPtr("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - const len = 104; - _ = write(1, msg, len); -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/hello_world_with_updates.6.zig b/test/cases/hello_world_with_updates.6.zig deleted file mode 100644 index 76f006992ed4..000000000000 --- a/test/cases/hello_world_with_updates.6.zig +++ /dev/null @@ -1,20 +0,0 @@ -const builtin = @import("builtin"); - -extern "c" fn write(c_int, usize, usize) usize; - -pub fn main() void { - print(); - print(); -} - -fn print() void { - const msg = @intFromPtr("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - const len = 104; - _ = write(1, msg, len); -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/int_to_ptr.0.zig b/test/cases/int_to_ptr.0.zig deleted file mode 100644 index 09efb8b1a5c8..000000000000 --- a/test/cases/int_to_ptr.0.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() void { - _ = @as(*u8, @ptrFromInt(0)); -} - -// error -// output_mode=Exe -// -// :2:18: error: pointer type '*u8' does not allow address zero diff --git a/test/cases/int_to_ptr.1.zig b/test/cases/int_to_ptr.1.zig deleted file mode 100644 index d5aed471e173..000000000000 --- a/test/cases/int_to_ptr.1.zig +++ /dev/null @@ -1,7 +0,0 @@ -pub fn main() void { - _ = @as(*u32, @ptrFromInt(2)); -} - -// error -// -// :2:19: error: pointer type '*u32' requires aligned address diff --git a/test/cases/locals.0.zig b/test/cases/locals.0.zig deleted file mode 100644 index 5698a66dcf49..000000000000 --- a/test/cases/locals.0.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - var i: u8 = 5; - var y: f32 = 42.0; - var x: u8 = 10; - if (false) { - &y; - &x / &i; - } - if (i != 5) unreachable; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/locals.1.zig b/test/cases/locals.1.zig deleted file mode 100644 index 0d0b63f6369f..000000000000 --- a/test/cases/locals.1.zig +++ /dev/null @@ -1,18 +0,0 @@ -pub fn main() void { - var i: u8 = 5; - var y: f32 = 42.0; - _ = &y; - var x: u8 = 10; - _ = &x; - foo(i, x); - i = x; - if (i != 10) unreachable; -} -fn foo(x: u8, y: u8) void { - _ = y; - var i: u8 = 10; - i = x; -} - -// run -// diff --git a/test/cases/lower_unnamed_consts_structs.0.zig b/test/cases/lower_unnamed_consts_structs.0.zig deleted file mode 100644 index 31232996461a..000000000000 --- a/test/cases/lower_unnamed_consts_structs.0.zig +++ /dev/null @@ -1,25 +0,0 @@ -const Foo = struct { - a: u8, - b: u32, - - fn first(self: *Foo) u8 { - return self.a; - } - - fn second(self: *Foo) u32 { - return self.b; - } -}; - -pub fn main() void { - var foo = Foo{ .a = 1, .b = 5 }; - assert(foo.first() == 1); - assert(foo.second() == 5); -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/lower_unnamed_consts_structs.1.zig b/test/cases/lower_unnamed_consts_structs.1.zig deleted file mode 100644 index 37afdc8a09c0..000000000000 --- a/test/cases/lower_unnamed_consts_structs.1.zig +++ /dev/null @@ -1,35 +0,0 @@ -const Foo = struct { - a: u8, - b: u32, - - fn first(self: *Foo) u8 { - return self.a; - } - - fn second(self: *Foo) u32 { - return self.b; - } -}; - -pub fn main() void { - var foo = Foo{ .a = 1, .b = 5 }; - assert(foo.first() == 1); - assert(foo.second() == 5); - - foo.a = 10; - foo.b = 255; - - assert(foo.first() == 10); - assert(foo.second() == 255); - - var foo2 = Foo{ .a = 15, .b = 255 }; - assert(foo2.first() == 15); - assert(foo2.second() == 255); -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/lower_unnamed_consts_structs.2.zig b/test/cases/lower_unnamed_consts_structs.2.zig deleted file mode 100644 index b437c4a030aa..000000000000 --- a/test/cases/lower_unnamed_consts_structs.2.zig +++ /dev/null @@ -1,25 +0,0 @@ -const Foo = struct { - a: u8, - b: u32, - - fn first(self: *Foo) u8 { - return self.a; - } - - fn second(self: *Foo) u32 { - return self.b; - } -}; - -pub fn main() void { - var foo2 = Foo{ .a = 15, .b = 255 }; - assert(foo2.first() == 15); - assert(foo2.second() == 255); -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/merge_error_sets.0.zig b/test/cases/merge_error_sets.0.zig deleted file mode 100644 index f1f3b9688309..000000000000 --- a/test/cases/merge_error_sets.0.zig +++ /dev/null @@ -1,18 +0,0 @@ -pub fn main() void { - const E = error{ A, B, D } || error{ A, B, C }; - E.A catch {}; - E.B catch {}; - E.C catch {}; - E.D catch {}; - const E2 = error{ X, Y } || @TypeOf(error.Z); - E2.X catch {}; - E2.Y catch {}; - E2.Z catch {}; - assert(anyerror || error{Z} == anyerror); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/merge_error_sets.1.zig b/test/cases/merge_error_sets.1.zig deleted file mode 100644 index 81c1cad134ec..000000000000 --- a/test/cases/merge_error_sets.1.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - const z = true || false; - _ = z; -} - -// error -// -// :2:15: error: expected error set type, found 'bool' -// :2:20: note: '||' merges error sets; 'or' performs boolean OR diff --git a/test/cases/multiplying_numbers_at_runtime_and_comptime.0.zig b/test/cases/multiplying_numbers_at_runtime_and_comptime.0.zig deleted file mode 100644 index f113928982fb..000000000000 --- a/test/cases/multiplying_numbers_at_runtime_and_comptime.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - mul(3, 4); -} - -fn mul(a: u32, b: u32) void { - if (a * b != 12) unreachable; -} - -// run -// target=x86_64-linux,x86_64-macos -// diff --git a/test/cases/multiplying_numbers_at_runtime_and_comptime.1.zig b/test/cases/multiplying_numbers_at_runtime_and_comptime.1.zig deleted file mode 100644 index 1dff884900dc..000000000000 --- a/test/cases/multiplying_numbers_at_runtime_and_comptime.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - if (x - 12 != 0) unreachable; -} - -fn mul(a: u32, b: u32) u32 { - return a * b; -} - -const x = mul(3, 4); - -// run -// diff --git a/test/cases/multiplying_numbers_at_runtime_and_comptime.2.zig b/test/cases/multiplying_numbers_at_runtime_and_comptime.2.zig deleted file mode 100644 index 8afbc51f53fe..000000000000 --- a/test/cases/multiplying_numbers_at_runtime_and_comptime.2.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() void { - var x: usize = 5; - _ = &x; - const y = mul(2, 3, x); - if (y - 30 != 0) unreachable; -} - -inline fn mul(a: usize, b: usize, c: usize) usize { - return a * b * c; -} - -// run -// diff --git a/test/cases/only_1_function_and_it_gets_updated.0.zig b/test/cases/only_1_function_and_it_gets_updated.0.zig deleted file mode 100644 index eada595db815..000000000000 --- a/test/cases/only_1_function_and_it_gets_updated.0.zig +++ /dev/null @@ -1,7 +0,0 @@ -pub export fn _start() noreturn { - while (true) {} -} - -// run -// target=x86_64-linux,x86_64-macos -// diff --git a/test/cases/only_1_function_and_it_gets_updated.1.zig b/test/cases/only_1_function_and_it_gets_updated.1.zig deleted file mode 100644 index 9982ca9ab813..000000000000 --- a/test/cases/only_1_function_and_it_gets_updated.1.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub export fn _start() noreturn { - var dummy: u32 = 10; - _ = &dummy; - while (true) {} -} - -// run -// diff --git a/test/cases/optional_payload.0.zig b/test/cases/optional_payload.0.zig deleted file mode 100644 index 65296875ff1c..000000000000 --- a/test/cases/optional_payload.0.zig +++ /dev/null @@ -1,19 +0,0 @@ -pub fn main() void { - var x: u32 = undefined; - const maybe_x = byPtr(&x); - assert(maybe_x != null); - maybe_x.?.* = 123; - assert(x == 123); -} - -fn byPtr(x: *u32) ?*u32 { - return x; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// target=x86_64-linux,x86_64-macos -// diff --git a/test/cases/optional_payload.1.zig b/test/cases/optional_payload.1.zig deleted file mode 100644 index 2d4dafffb9bd..000000000000 --- a/test/cases/optional_payload.1.zig +++ /dev/null @@ -1,17 +0,0 @@ -pub fn main() void { - var x: u32 = undefined; - const maybe_x = byPtr(&x); - assert(maybe_x == null); -} - -fn byPtr(x: *u32) ?*u32 { - _ = x; - return null; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/optional_payload.2.zig b/test/cases/optional_payload.2.zig deleted file mode 100644 index 608310923bad..000000000000 --- a/test/cases/optional_payload.2.zig +++ /dev/null @@ -1,18 +0,0 @@ -pub fn main() void { - var x: u8 = undefined; - const maybe_x = byPtr(&x); - assert(maybe_x != null); - maybe_x.?.* = 255; - assert(x == 255); -} - -fn byPtr(x: *u8) ?*u8 { - return x; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/optional_payload.3.zig b/test/cases/optional_payload.3.zig deleted file mode 100644 index b81ec398c7a2..000000000000 --- a/test/cases/optional_payload.3.zig +++ /dev/null @@ -1,18 +0,0 @@ -pub fn main() void { - var x: i8 = undefined; - const maybe_x = byPtr(&x); - assert(maybe_x != null); - maybe_x.?.* = -1; - assert(x == -1); -} - -fn byPtr(x: *i8) ?*i8 { - return x; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/optionals.0.zig b/test/cases/optionals.0.zig deleted file mode 100644 index 49841ac59322..000000000000 --- a/test/cases/optionals.0.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var x: ?u8 = 5; - _ = &x; - var y: u8 = 0; - if (x) |val| { - y = val; - } - return y - 5; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/optionals.1.zig b/test/cases/optionals.1.zig deleted file mode 100644 index 4bba10fc368d..000000000000 --- a/test/cases/optionals.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var x: ?u8 = null; - _ = &x; - var y: u8 = 0; - if (x) |val| { - y = val; - } - return y; -} - -// run -// diff --git a/test/cases/optionals.2.zig b/test/cases/optionals.2.zig deleted file mode 100644 index 0464db35422b..000000000000 --- a/test/cases/optionals.2.zig +++ /dev/null @@ -1,8 +0,0 @@ -pub fn main() u8 { - var x: ?u8 = 5; - _ = &x; - return x.? - 5; -} - -// run -// diff --git a/test/cases/optionals.3.zig b/test/cases/optionals.3.zig deleted file mode 100644 index 849914fbb5c8..000000000000 --- a/test/cases/optionals.3.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() u8 { - var x: u8 = 5; - var y: ?u8 = x; - _ = .{ &x, &y }; - return y.? - 5; -} - -// run -// diff --git a/test/cases/optionals.4.zig b/test/cases/optionals.4.zig deleted file mode 100644 index af3400b322a9..000000000000 --- a/test/cases/optionals.4.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var val: ?u8 = 5; - while (val) |*v| { - v.* -= 1; - if (v.* == 2) { - val = null; - } - } - return 0; -} - -// run -// diff --git a/test/cases/orelse_at_comptime.0.zig b/test/cases/orelse_at_comptime.0.zig deleted file mode 100644 index 5397ca3b0afa..000000000000 --- a/test/cases/orelse_at_comptime.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const i: ?u64 = 0; - const result = i orelse 5; - assert(result == 0); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/orelse_at_comptime.1.zig b/test/cases/orelse_at_comptime.1.zig deleted file mode 100644 index 7d4fcd3178a3..000000000000 --- a/test/cases/orelse_at_comptime.1.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const i: ?u64 = null; - const result = i orelse 5; - assert(result == 5); -} -fn assert(b: bool) void { - if (!b) unreachable; -} - -// run -// diff --git a/test/cases/parameters_and_return_values.0.zig b/test/cases/parameters_and_return_values.0.zig deleted file mode 100644 index bf07cf2921f7..000000000000 --- a/test/cases/parameters_and_return_values.0.zig +++ /dev/null @@ -1,20 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(id(14)); -} - -fn id(x: u32) u32 { - return x; -} - -fn print(len: u32) void { - const str = "Hello, World!\n"; - _ = std.posix.write(1, str[0..len]) catch {}; -} - -// run -// target=x86_64-macos -// -// Hello, World! -// diff --git a/test/cases/parameters_and_return_values.1.zig b/test/cases/parameters_and_return_values.1.zig deleted file mode 100644 index f2bc35d22ec6..000000000000 --- a/test/cases/parameters_and_return_values.1.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() void { - assert(add(1, 2, 3, 4, 5, 6) == 21); -} - -fn add(a: u32, b: u32, c: u32, d: u32, e: u32, f: u32) u32 { - return a + b + c + d + e + f; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/pointers.0.zig b/test/cases/pointers.0.zig deleted file mode 100644 index 958ee5ac8860..000000000000 --- a/test/cases/pointers.0.zig +++ /dev/null @@ -1,14 +0,0 @@ -pub fn main() u8 { - var x: u8 = 0; - - foo(&x); - return x - 2; -} - -fn foo(x: *u8) void { - x.* = 2; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/pointers.1.zig b/test/cases/pointers.1.zig deleted file mode 100644 index b3649cf52043..000000000000 --- a/test/cases/pointers.1.zig +++ /dev/null @@ -1,18 +0,0 @@ -pub fn main() u8 { - var x: u8 = 0; - - foo(&x); - bar(&x); - return x - 4; -} - -fn foo(x: *u8) void { - x.* = 2; -} - -fn bar(x: *u8) void { - x.* += 2; -} - -// run -// diff --git a/test/cases/redundant_comptime.0.zig b/test/cases/redundant_comptime.0.zig deleted file mode 100644 index c1ecbf7acec7..000000000000 --- a/test/cases/redundant_comptime.0.zig +++ /dev/null @@ -1,7 +0,0 @@ -pub fn main() void { - var a: comptime u32 = 0; -} - -// error -// -// :2:12: error: redundant comptime keyword in already comptime scope diff --git a/test/cases/redundant_comptime.1.zig b/test/cases/redundant_comptime.1.zig deleted file mode 100644 index 79226ae8a6b2..000000000000 --- a/test/cases/redundant_comptime.1.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - comptime { - var a: u32 = comptime 0; - } -} - -// error -// -// :3:22: error: redundant comptime keyword in already comptime scope diff --git a/test/cases/spilling_registers.0.zig b/test/cases/spilling_registers.0.zig deleted file mode 100644 index eb580cf5d811..000000000000 --- a/test/cases/spilling_registers.0.zig +++ /dev/null @@ -1,38 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 791); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = k + c; // 217 - const m = l + d; // 227 - const n = m + e; // 241 - const o = n + f; // 265 - const p = o + g; // 303 - const q = p + h; // 365 - const r = q + i; // 465 - const s = r + j; // 575 - const t = s + k; // 785 - break :blk t; - }; - const y = x + a; // 788 - const z = y + a; // 791 - return z; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// target=x86_64-linux,x86_64-macos -// diff --git a/test/cases/spilling_registers.1.zig b/test/cases/spilling_registers.1.zig deleted file mode 100644 index f401a5d7b7d1..000000000000 --- a/test/cases/spilling_registers.1.zig +++ /dev/null @@ -1,37 +0,0 @@ -pub fn main() void { - assert(addMul(3, 4) == 357747496); -} - -fn addMul(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = k + c; // 217 - const m = l * d; // 2170 - const n = m + e; // 2184 - const o = n * f; // 52416 - const p = o + g; // 52454 - const q = p * h; // 3252148 - const r = q + i; // 3252248 - const s = r * j; // 357747280 - const t = s + k; // 357747490 - break :blk t; - }; - const y = x + a; // 357747493 - const z = y + a; // 357747496 - return z; -} - -fn assert(ok: bool) void { - if (!ok) unreachable; -} - -// run -// diff --git a/test/cases/structs.0.zig b/test/cases/structs.0.zig deleted file mode 100644 index 306cf73ebfa5..000000000000 --- a/test/cases/structs.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -const Example = struct { x: u8 }; - -pub fn main() u8 { - var example: Example = .{ .x = 5 }; - _ = &example; - return example.x - 5; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/structs.1.zig b/test/cases/structs.1.zig deleted file mode 100644 index 8d4250e4a2ac..000000000000 --- a/test/cases/structs.1.zig +++ /dev/null @@ -1,10 +0,0 @@ -const Example = struct { x: u8 }; - -pub fn main() u8 { - var example: Example = .{ .x = 5 }; - example.x = 10; - return example.x - 10; -} - -// run -// diff --git a/test/cases/structs.2.zig b/test/cases/structs.2.zig deleted file mode 100644 index 7593284301b2..000000000000 --- a/test/cases/structs.2.zig +++ /dev/null @@ -1,10 +0,0 @@ -const Example = struct { x: u8, y: u8 }; - -pub fn main() u8 { - var example: Example = .{ .x = 5, .y = 10 }; - _ = &example; - return example.y + example.x - 15; -} - -// run -// diff --git a/test/cases/structs.3.zig b/test/cases/structs.3.zig deleted file mode 100644 index cfc064d67103..000000000000 --- a/test/cases/structs.3.zig +++ /dev/null @@ -1,13 +0,0 @@ -const Example = struct { x: u8, y: u8 }; - -pub fn main() u8 { - var example: Example = .{ .x = 5, .y = 10 }; - var example2: Example = .{ .x = 10, .y = 20 }; - _ = &example2; - - example = example2; - return example.y + example.x - 30; -} - -// run -// diff --git a/test/cases/structs.4.zig b/test/cases/structs.4.zig deleted file mode 100644 index 2d37446c5692..000000000000 --- a/test/cases/structs.4.zig +++ /dev/null @@ -1,11 +0,0 @@ -const Example = struct { x: u8, y: u8 }; - -pub fn main() u8 { - var example: Example = .{ .x = 5, .y = 10 }; - - example = .{ .x = 10, .y = 20 }; - return example.y + example.x - 30; -} - -// run -// diff --git a/test/cases/switch.0.zig b/test/cases/switch.0.zig deleted file mode 100644 index f4a79fa772b3..000000000000 --- a/test/cases/switch.0.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() u8 { - var val: u8 = 1; - _ = &val; - const a: u8 = switch (val) { - 0, 1 => 2, - 2 => 3, - 3 => 4, - else => 5, - }; - - return a - 2; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/switch.1.zig b/test/cases/switch.1.zig deleted file mode 100644 index d93e1ccb4740..000000000000 --- a/test/cases/switch.1.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() u8 { - var val: u8 = 2; - _ = &val; - var a: u8 = switch (val) { - 0, 1 => 2, - 2 => 3, - 3 => 4, - else => 5, - }; - _ = &a; - - return a - 3; -} - -// run -// diff --git a/test/cases/switch.2.zig b/test/cases/switch.2.zig deleted file mode 100644 index 1506d822d1c1..000000000000 --- a/test/cases/switch.2.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() u8 { - var val: u8 = 10; - _ = &val; - const a: u8 = switch (val) { - 0, 1 => 2, - 2 => 3, - 3 => 4, - else => 5, - }; - - return a - 5; -} - -// run -// diff --git a/test/cases/switch.3.zig b/test/cases/switch.3.zig deleted file mode 100644 index 6225dda3ff87..000000000000 --- a/test/cases/switch.3.zig +++ /dev/null @@ -1,16 +0,0 @@ -const MyEnum = enum { One, Two, Three }; - -pub fn main() u8 { - var val: MyEnum = .Two; - _ = &val; - const a: u8 = switch (val) { - .One => 1, - .Two => 2, - .Three => 3, - }; - - return a - 2; -} - -// run -// diff --git a/test/cases/type_of.0.zig b/test/cases/type_of.0.zig deleted file mode 100644 index 823572c86364..000000000000 --- a/test/cases/type_of.0.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() void { - var x: usize = 0; - _ = &x; - const z = @TypeOf(x, @as(u128, 5)); - assert(z == u128); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/type_of.1.zig b/test/cases/type_of.1.zig deleted file mode 100644 index 86d7d87a19da..000000000000 --- a/test/cases/type_of.1.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - const z = @TypeOf(true); - assert(z == bool); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/type_of.2.zig b/test/cases/type_of.2.zig deleted file mode 100644 index cdbc8121fd71..000000000000 --- a/test/cases/type_of.2.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - _ = @TypeOf(true, 1); -} - -// error -// -// :2:9: error: incompatible types: 'bool' and 'comptime_int' -// :2:17: note: type 'bool' here -// :2:23: note: type 'comptime_int' here diff --git a/test/cases/unused_labels.0.zig b/test/cases/unused_labels.0.zig deleted file mode 100644 index 9afa5facdde2..000000000000 --- a/test/cases/unused_labels.0.zig +++ /dev/null @@ -1,8 +0,0 @@ -comptime { - foo: {} -} - -// error -// output_mode=Exe -// -// :2:5: error: unused block label diff --git a/test/cases/unused_labels.1.zig b/test/cases/unused_labels.1.zig deleted file mode 100644 index c7ff576875dc..000000000000 --- a/test/cases/unused_labels.1.zig +++ /dev/null @@ -1,7 +0,0 @@ -comptime { - foo: while (true) {} -} - -// error -// -// :2:5: error: unused while loop label diff --git a/test/cases/unused_labels.2.zig b/test/cases/unused_labels.2.zig deleted file mode 100644 index babe3c7b0a1d..000000000000 --- a/test/cases/unused_labels.2.zig +++ /dev/null @@ -1,7 +0,0 @@ -comptime { - foo: for ("foo") |_| {} -} - -// error -// -// :2:5: error: unused for loop label diff --git a/test/cases/unused_labels.3.zig b/test/cases/unused_labels.3.zig deleted file mode 100644 index 36c9aa2319b0..000000000000 --- a/test/cases/unused_labels.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - blk: { - blk: {} - } -} - -// error -// -// :2:11: error: redefinition of label 'blk' -// :2:5: note: previous definition here diff --git a/test/cases/variable_shadowing.0.zig b/test/cases/variable_shadowing.0.zig deleted file mode 100644 index accfda758f95..000000000000 --- a/test/cases/variable_shadowing.0.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - var i: u32 = 10; - var i: u32 = 10; -} - -// error -// backend=stage2 -// target=x86_64-linux,x86_64-macos -// -// :3:9: error: redeclaration of local variable 'i' -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.1.zig b/test/cases/variable_shadowing.1.zig deleted file mode 100644 index 2a2945a65f7e..000000000000 --- a/test/cases/variable_shadowing.1.zig +++ /dev/null @@ -1,9 +0,0 @@ -var testing: i64 = 10; -pub fn main() void { - var testing: i64 = 20; -} - -// error -// -// :3:9: error: local variable shadows declaration of 'testing' -// :1:1: note: declared here diff --git a/test/cases/variable_shadowing.10.zig b/test/cases/variable_shadowing.10.zig deleted file mode 100644 index 6aa9f5a9bfd7..000000000000 --- a/test/cases/variable_shadowing.10.zig +++ /dev/null @@ -1,9 +0,0 @@ -fn foo() !void { - var i: anyerror!usize = 1; - _ = i catch |i| return i; -} - -// error -// -// :3:18: error: redeclaration of local variable 'i' -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.2.zig b/test/cases/variable_shadowing.2.zig deleted file mode 100644 index a44372f9b978..000000000000 --- a/test/cases/variable_shadowing.2.zig +++ /dev/null @@ -1,13 +0,0 @@ -fn a() type { - return struct { - pub fn b() void { - const c = 6; - const c = 69; - } - }; -} - -// error -// -// :5:19: error: redeclaration of local constant 'c' -// :4:19: note: previous declaration here diff --git a/test/cases/variable_shadowing.3.zig b/test/cases/variable_shadowing.3.zig deleted file mode 100644 index af16bccc1478..000000000000 --- a/test/cases/variable_shadowing.3.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - for ("n", 0..) |_, i| {} -} - -// error -// -// :3:24: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.4.zig b/test/cases/variable_shadowing.4.zig deleted file mode 100644 index 3653c2457de7..000000000000 --- a/test/cases/variable_shadowing.4.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - for ("n") |i| {} -} - -// error -// -// :3:16: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.5.zig b/test/cases/variable_shadowing.5.zig deleted file mode 100644 index 78247e68feaa..000000000000 --- a/test/cases/variable_shadowing.5.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - while ("n") |i| {} -} - -// error -// -// :3:18: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.6.zig b/test/cases/variable_shadowing.6.zig deleted file mode 100644 index a3ae7bc34687..000000000000 --- a/test/cases/variable_shadowing.6.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - var i = 0; - while ("n") |bruh| { - _ = bruh; - } else |i| {} -} - -// error -// -// :5:13: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.7.zig b/test/cases/variable_shadowing.7.zig deleted file mode 100644 index e8368699b4dd..000000000000 --- a/test/cases/variable_shadowing.7.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - if (true) |i| {} -} - -// error -// -// :3:16: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.8.zig b/test/cases/variable_shadowing.8.zig deleted file mode 100644 index 1a3f560589ae..000000000000 --- a/test/cases/variable_shadowing.8.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - if (true) |i| {} else |e| {} -} - -// error -// -// :3:16: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/variable_shadowing.9.zig b/test/cases/variable_shadowing.9.zig deleted file mode 100644 index 28e2b16834bf..000000000000 --- a/test/cases/variable_shadowing.9.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - var i = 0; - if (true) |_| {} else |i| {} -} - -// error -// -// :3:28: error: capture 'i' shadows local variable from outer scope -// :2:9: note: previous declaration here diff --git a/test/cases/while_loops.0.zig b/test/cases/while_loops.0.zig deleted file mode 100644 index 721b127ff54a..000000000000 --- a/test/cases/while_loops.0.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var i: u8 = 0; - while (i < @as(u8, 5)) { - i += 1; - } - - return i - 5; -} - -// run -// target=wasm32-wasi -// diff --git a/test/cases/while_loops.1.zig b/test/cases/while_loops.1.zig deleted file mode 100644 index 283398adbce8..000000000000 --- a/test/cases/while_loops.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() u8 { - var i: u8 = 0; - while (i < @as(u8, 10)) { - var x: u8 = 1; - _ = &x; - i += x; - } - return i - 10; -} - -// run -// diff --git a/test/cases/while_loops.2.zig b/test/cases/while_loops.2.zig deleted file mode 100644 index fa4f9ed26c23..000000000000 --- a/test/cases/while_loops.2.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() u8 { - var i: u8 = 0; - while (i < @as(u8, 10)) { - var x: u8 = 1; - _ = &x; - i += x; - if (i == @as(u8, 5)) break; - } - return i - 5; -} - -// run -// diff --git a/test/cases/x86_64-linux/inline_assembly.0.zig b/test/cases/x86_64-linux/inline_assembly.0.zig deleted file mode 100644 index 8356e05d8083..000000000000 --- a/test/cases/x86_64-linux/inline_assembly.0.zig +++ /dev/null @@ -1,16 +0,0 @@ -pub fn main() void { - const number = 1234; - const x = asm volatile ("syscall" - : [o] "{rax}" (-> number), - : [number] "{rax}" (231), - [arg1] "{rdi}" (60), - : "rcx", "r11", "memory" - ); - _ = x; -} - -// error -// output_mode=Exe -// target=x86_64-linux -// -// :4:27: error: expected type 'type', found 'comptime_int' diff --git a/test/cases/x86_64-linux/inline_assembly.1.zig b/test/cases/x86_64-linux/inline_assembly.1.zig deleted file mode 100644 index b35014b0f6b6..000000000000 --- a/test/cases/x86_64-linux/inline_assembly.1.zig +++ /dev/null @@ -1,15 +0,0 @@ -const S = struct { - comptime { - asm volatile ( - \\zig_moment: - \\syscall - ); - } -}; -pub fn main() void { - _ = S; -} - -// error -// -// :3:13: error: volatile is meaningless on global assembly diff --git a/test/cases/x86_64-linux/inline_assembly.2.zig b/test/cases/x86_64-linux/inline_assembly.2.zig deleted file mode 100644 index 7958d0df71ea..000000000000 --- a/test/cases/x86_64-linux/inline_assembly.2.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - var bruh: u32 = 1; - asm ("" - : - : [bruh] "{rax}" (4), - : "memory" - ); -} - -// error -// -// :3:5: error: assembly expression with no output must be marked volatile diff --git a/test/cases/x86_64-linux/inline_assembly.3.zig b/test/cases/x86_64-linux/inline_assembly.3.zig deleted file mode 100644 index a6f57e832a74..000000000000 --- a/test/cases/x86_64-linux/inline_assembly.3.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void {} -comptime { - asm ("" - : - : [bruh] "{rax}" (4), - : "memory" - ); -} - -// error -// -// :3:5: error: global assembly cannot have inputs, outputs, or clobbers diff --git a/test/incremental/change_fn_type b/test/incremental/change_fn_type new file mode 100644 index 000000000000..892d0dd9b6b4 --- /dev/null +++ b/test/incremental/change_fn_type @@ -0,0 +1,35 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +pub fn main() !void { + try foo(123); +} +fn foo(x: u8) !void { + return std.io.getStdOut().writer().print("{d}\n", .{x}); +} +const std = @import("std"); +#expect_stdout="123\n" + +#update=change function type +#file=main.zig +pub fn main() !void { + try foo(123); +} +fn foo(x: i64) !void { + return std.io.getStdOut().writer().print("{d}\n", .{x}); +} +const std = @import("std"); +#expect_stdout="123\n" + +#update=change function argument +#file=main.zig +pub fn main() !void { + try foo(-42); +} +fn foo(x: i64) !void { + return std.io.getStdOut().writer().print("{d}\n", .{x}); +} +const std = @import("std"); +#expect_stdout="-42\n" diff --git a/test/incremental/change_struct_same_fields b/test/incremental/change_struct_same_fields new file mode 100644 index 000000000000..f742bab87031 --- /dev/null +++ b/test/incremental/change_struct_same_fields @@ -0,0 +1,50 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +const S = extern struct { x: u8, y: u8 }; +pub fn main() !void { + const val: S = .{ .x = 100, .y = 200 }; + try foo(&val); +} +fn foo(val: *const S) !void { + try std.io.getStdOut().writer().print( + "{d} {d}\n", + .{ val.x, val.y }, + ); +} +const std = @import("std"); +#expect_stdout="100 200\n" + +#update=change struct layout +#file=main.zig +const S = extern struct { x: u32, y: u32 }; +pub fn main() !void { + const val: S = .{ .x = 100, .y = 200 }; + try foo(&val); +} +fn foo(val: *const S) !void { + try std.io.getStdOut().writer().print( + "{d} {d}\n", + .{ val.x, val.y }, + ); +} +const std = @import("std"); +#expect_stdout="100 200\n" + +#update=change values +#file=main.zig +const S = extern struct { x: u32, y: u32 }; +pub fn main() !void { + const val: S = .{ .x = 1234, .y = 5678 }; + try foo(&val); +} +fn foo(val: *const S) !void { + try std.io.getStdOut().writer().print( + "{d} {d}\n", + .{ val.x, val.y }, + ); +} +const std = @import("std"); +#expect_stdout="1234 5678\n" diff --git a/test/incremental/compile_error_then_log b/test/incremental/compile_error_then_log new file mode 100644 index 000000000000..00ccef9290d1 --- /dev/null +++ b/test/incremental/compile_error_then_log @@ -0,0 +1,21 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version with compile error +#file=main.zig +comptime { + @compileError("this is an error"); +} +comptime { + @compileLog("this is a log"); +} +#expect_error=ignored +#update=remove the compile error +#file=main.zig +comptime { + //@compileError("this is an error"); +} +comptime { + @compileLog("this is a log"); +} +#expect_error=ignored diff --git a/test/incremental/function_becomes_inline b/test/incremental/function_becomes_inline new file mode 100644 index 000000000000..b7e604bfac44 --- /dev/null +++ b/test/incremental/function_becomes_inline @@ -0,0 +1,35 @@ +//#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=non-inline version +#file=main.zig +pub fn main() !void { + try foo(); +} +fn foo() !void { + try std.io.getStdOut().writer().writeAll("Hello, World!\n"); +} +const std = @import("std"); +#expect_stdout="Hello, World!\n" + +#update=make function inline +#file=main.zig +pub fn main() !void { + try foo(); +} +inline fn foo() !void { + try std.io.getStdOut().writer().writeAll("Hello, World!\n"); +} +const std = @import("std"); +#expect_stdout="Hello, World!\n" + +#update=change string +#file=main.zig +pub fn main() !void { + try foo(); +} +inline fn foo() !void { + try std.io.getStdOut().writer().writeAll("Hello, `inline` World!\n"); +} +const std = @import("std"); +#expect_stdout="Hello, `inline` World!\n" diff --git a/test/incremental/recursive_function_becomes_non_recursive b/test/incremental/recursive_function_becomes_non_recursive new file mode 100644 index 000000000000..7a9eb5d26f4f --- /dev/null +++ b/test/incremental/recursive_function_becomes_non_recursive @@ -0,0 +1,28 @@ +//#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +pub fn main() !void { + try foo(false); +} +fn foo(recurse: bool) !void { + const stdout = std.io.getStdOut().writer(); + if (recurse) return foo(true); + try stdout.writeAll("non-recursive path\n"); +} +const std = @import("std"); +#expect_stdout="non-recursive path\n" + +#update=eliminate recursion and change argument +#file=main.zig +pub fn main() !void { + try foo(true); +} +fn foo(recurse: bool) !void { + const stdout = std.io.getStdOut().writer(); + if (recurse) return stdout.writeAll("x==1\n"); + try stdout.writeAll("non-recursive path\n"); +} +const std = @import("std"); +#expect_stdout="x==1\n" From 6e56bc1096eb99a065bc7222bf3264142251da6d Mon Sep 17 00:00:00 2001 From: mlugg Date: Mon, 11 Nov 2024 12:20:30 +0000 Subject: [PATCH 2/2] test: add new incremental case This is similar to the old `llvm/shift_right_plus_left` case, which was disabled by 1b1c78c. The case is not enabled on the LLVM backend, since incremental compilation support for this backend is a work in progress and is tracked by #21165. It passes on the x86_64-linux target with the self-hosted backend. Resolves: #12288 --- test/incremental/change_shift_op | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/incremental/change_shift_op diff --git a/test/incremental/change_shift_op b/test/incremental/change_shift_op new file mode 100644 index 000000000000..bd88a70def9e --- /dev/null +++ b/test/incremental/change_shift_op @@ -0,0 +1,23 @@ +#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +pub fn main() !void { + try foo(0x1300); +} +fn foo(x: u16) !void { + try std.io.getStdOut().writer().print("0x{x}\n", .{x << 4}); +} +const std = @import("std"); +#expect_stdout="0x3000\n" +#update=change to right shift +#file=main.zig +pub fn main() !void { + try foo(0x1300); +} +fn foo(x: u16) !void { + try std.io.getStdOut().writer().print("0x{x}\n", .{x >> 4}); +} +const std = @import("std"); +#expect_stdout="0x130\n"