From 67e6df4313a982fa08ab6ec6de1da427aaf83409 Mon Sep 17 00:00:00 2001 From: mlugg Date: Fri, 18 Jul 2025 09:53:57 +0100 Subject: [PATCH] tests: remove more old async tests The rejection of #6025 indicates that if stackless coroutines return to Zig, they will look quite different; see #23446 for the working draft proposal for their return (though it will definitely be tweaked before being accepted). Some of this test coverage was deleted in 40d11cc, but because stackless coroutines will take on a new form if re-introduced, I anticipate that essentially *none* of this coverage will be relevant. Of course, if it for some reason is, we can always grab it from the Git history. --- test/behavior/type_info.zig | 14 ----------- .../async/Frame_of_generic_function.zig | 14 ----------- .../async/bad_alignment_in_asynccall.zig | 13 ---------- .../async/exported_async_function.zig | 7 ------ ..._called_outside_of_function_definition.zig | 11 --------- .../frame_causes_function_to_be_async.zig | 13 ---------- ...eventually_is_inferred_to_become_async.zig | 15 ------------ ...c_function_pointer_passed_to_asyncCall.zig | 13 ---------- ...bad_implicit_casting_of_anyframe_types.zig | 24 ------------------- ...g_type_for_argument_tuple_to_asyncCall.zig | 14 ----------- ...suspend function call, callee suspends.zig | 20 ---------------- 11 files changed, 158 deletions(-) delete mode 100644 test/cases/compile_errors/async/Frame_of_generic_function.zig delete mode 100644 test/cases/compile_errors/async/bad_alignment_in_asynccall.zig delete mode 100644 test/cases/compile_errors/async/exported_async_function.zig delete mode 100644 test/cases/compile_errors/async/frame_called_outside_of_function_definition.zig delete mode 100644 test/cases/compile_errors/async/frame_causes_function_to_be_async.zig delete mode 100644 test/cases/compile_errors/async/non-async_function_pointer_eventually_is_inferred_to_become_async.zig delete mode 100644 test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig delete mode 100644 test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig delete mode 100644 test/cases/compile_errors/async/wrong_type_for_argument_tuple_to_asyncCall.zig delete mode 100644 test/cases/safety/nosuspend function call, callee suspends.zig diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig index f19d90696be0cfcaed6c71dad13f5776ab9433c7..aea8cbb6aa21924da9f4395d98abd8babd8f0f9b 100644 --- a/test/behavior/type_info.zig +++ b/test/behavior/type_info.zig @@ -539,20 +539,6 @@ fn add(a: i32, b: i32) i32 { return a + b; } -test "type info for async frames" { - if (true) { - // https://github.com/ziglang/zig/issues/6025 - return error.SkipZigTest; - } - - switch (@typeInfo(@Frame(add))) { - .frame => |frame| { - try expect(@as(@TypeOf(add), @ptrCast(frame.function)) == add); - }, - else => unreachable, - } -} - test "Declarations are returned in declaration order" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; diff --git a/test/cases/compile_errors/async/Frame_of_generic_function.zig b/test/cases/compile_errors/async/Frame_of_generic_function.zig deleted file mode 100644 index af0fb5c72edeaf840439695f1530312357cf4d55..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/Frame_of_generic_function.zig +++ /dev/null @@ -1,14 +0,0 @@ -export fn entry() void { - var frame: @Frame(func) = undefined; - _ = &frame; -} -fn func(comptime T: type) void { - var x: T = undefined; - _ = &x; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:16: error: @Frame() of generic function diff --git a/test/cases/compile_errors/async/bad_alignment_in_asynccall.zig b/test/cases/compile_errors/async/bad_alignment_in_asynccall.zig deleted file mode 100644 index c30815e7e080c85a48a8b27d250c0bb2ee691515..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/bad_alignment_in_asynccall.zig +++ /dev/null @@ -1,13 +0,0 @@ -export fn entry() void { - var ptr: fn () callconv(.@"async") void = func; - var bytes: [64]u8 = undefined; - _ = @asyncCall(&bytes, {}, ptr, .{}); - _ = &ptr; -} -fn func() callconv(.@"async") void {} - -// error -// backend=stage1 -// target=aarch64-linux-none -// -// tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8' diff --git a/test/cases/compile_errors/async/exported_async_function.zig b/test/cases/compile_errors/async/exported_async_function.zig deleted file mode 100644 index c3be7d4b8004ec64812f2d5556c0f6c01d541beb..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/exported_async_function.zig +++ /dev/null @@ -1,7 +0,0 @@ -export fn foo() callconv(.@"async") void {} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:1:1: error: exported function cannot be async diff --git a/test/cases/compile_errors/async/frame_called_outside_of_function_definition.zig b/test/cases/compile_errors/async/frame_called_outside_of_function_definition.zig deleted file mode 100644 index d14099815287f35321510c87104e0a5831a970a6..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/frame_called_outside_of_function_definition.zig +++ /dev/null @@ -1,11 +0,0 @@ -var handle_undef: anyframe = undefined; -var handle_dummy: anyframe = @frame(); -export fn entry() bool { - return handle_undef == handle_dummy; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:2:30: error: @frame() called outside of function definition diff --git a/test/cases/compile_errors/async/frame_causes_function_to_be_async.zig b/test/cases/compile_errors/async/frame_causes_function_to_be_async.zig deleted file mode 100644 index f8493b08b2c9e3374ee9c5c8297601c397964dea..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/frame_causes_function_to_be_async.zig +++ /dev/null @@ -1,13 +0,0 @@ -export fn entry() void { - func(); -} -fn func() void { - _ = @frame(); -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:1:1: error: function with calling convention 'C' cannot be async -// tmp.zig:5:9: note: @frame() causes function to be async diff --git a/test/cases/compile_errors/async/non-async_function_pointer_eventually_is_inferred_to_become_async.zig b/test/cases/compile_errors/async/non-async_function_pointer_eventually_is_inferred_to_become_async.zig deleted file mode 100644 index e18b4200289d80343d38cee2da9101f81916c0f5..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/non-async_function_pointer_eventually_is_inferred_to_become_async.zig +++ /dev/null @@ -1,15 +0,0 @@ -export fn a() void { - var non_async_fn: fn () void = undefined; - non_async_fn = func; -} -fn func() void { - suspend {} -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:5:1: error: 'func' cannot be async -// tmp.zig:3:20: note: required to be non-async here -// tmp.zig:6:5: note: suspends here diff --git a/test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig b/test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig deleted file mode 100644 index b62524f6de11afb5be59ceb2a5d1ba75c6edf277..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig +++ /dev/null @@ -1,13 +0,0 @@ -export fn entry() void { - var ptr = afunc; - var bytes: [100]u8 align(16) = undefined; - _ = @asyncCall(&bytes, {}, ptr, .{}); - _ = &ptr; -} -fn afunc() void {} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:4:32: error: expected async function, found 'fn () void' diff --git a/test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig b/test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig deleted file mode 100644 index 6ab99bf00dc0f52d613a8d7a399cc1c5c38f55de..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig +++ /dev/null @@ -1,24 +0,0 @@ -export fn a() void { - var x: anyframe = undefined; - var y: anyframe->i32 = x; - _ = .{ &x, &y }; -} -export fn b() void { - var x: i32 = undefined; - var y: anyframe->i32 = x; - _ = .{ &x, &y }; -} -export fn c() void { - var x: @Frame(func) = undefined; - var y: anyframe->i32 = &x; - _ = .{ &x, &y }; -} -fn func() void {} - -// error -// backend=stage1 -// target=native -// -// :3:28: error: expected type 'anyframe->i32', found 'anyframe' -// :8:28: error: expected type 'anyframe->i32', found 'i32' -// tmp.zig:13:29: error: expected type 'anyframe->i32', found '*@Frame(func)' diff --git a/test/cases/compile_errors/async/wrong_type_for_argument_tuple_to_asyncCall.zig b/test/cases/compile_errors/async/wrong_type_for_argument_tuple_to_asyncCall.zig deleted file mode 100644 index 7a9be0a8cc6e9123a0beb597d4be2683aa7546ff..0000000000000000000000000000000000000000 --- a/test/cases/compile_errors/async/wrong_type_for_argument_tuple_to_asyncCall.zig +++ /dev/null @@ -1,14 +0,0 @@ -export fn entry1() void { - var frame: @Frame(foo) = undefined; - @asyncCall(&frame, {}, foo, {}); -} - -fn foo() i32 { - return 0; -} - -// error -// backend=stage1 -// target=native -// -// tmp.zig:3:33: error: expected tuple or struct, found 'void' diff --git a/test/cases/safety/nosuspend function call, callee suspends.zig b/test/cases/safety/nosuspend function call, callee suspends.zig deleted file mode 100644 index 50f457f31458024c555d3a4c374ffb6e05cd67ac..0000000000000000000000000000000000000000 --- a/test/cases/safety/nosuspend function call, callee suspends.zig +++ /dev/null @@ -1,20 +0,0 @@ -const std = @import("std"); - -pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { - _ = message; - _ = stack_trace; - std.process.exit(0); -} -pub fn main() !void { - _ = nosuspend add(101, 100); - return error.TestFailed; -} -fn add(a: i32, b: i32) i32 { - if (a > 100) { - suspend {} - } - return a + b; -} -// run -// backend=stage1 -// target=native -- 2.54.0