mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
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.
This commit is contained in:
parent
69cf40da60
commit
67e6df4313
11 changed files with 0 additions and 158 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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'
|
||||
|
|
@ -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)'
|
||||
|
|
@ -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'
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Reference in a new issue