| author | |
| committer | |
| log | 423d7a74a479c1fae16024daed8edfbb2cf1b857 |
| tree | 259a79f4e1a7cafcb9ced47011362c7a49c88f3a |
| parent | 327fb798c3a2fb18588fc79b1f024cfdd166a4e9 |
40 files changed, 310 insertions(+), 310 deletions(-)
test/cases/compile_errors/async/Frame_of_generic_function.zig created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame: @Frame(func) = undefined; | |
| 3 | _ = frame; | |
| 4 | } | |
| 5 | fn func(comptime T: type) void { | |
| 6 | var x: T = undefined; | |
| 7 | _ = x; | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:2:16: error: @Frame() of generic function |
test/cases/compile_errors/async/async_function_depends_on_its_own_frame.zig created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | var x: [@sizeOf(@Frame(amain))]u8 = undefined; | |
| 6 | _ = x; | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage1 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet |
test/cases/compile_errors/async/async_function_indirectly_depends_on_its_own_frame.zig created+17| ... | ... | @@ -0,0 +1,17 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | other(); | |
| 6 | } | |
| 7 | fn other() void { | |
| 8 | var x: [@sizeOf(@Frame(amain))]u8 = undefined; | |
| 9 | _ = x; | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:4:1: error: unable to determine async function frame of 'amain' | |
| 17 | // tmp.zig:5:10: note: analysis of function 'other' depends on the frame |
test/cases/compile_errors/async/bad_alignment_in_asynccall.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr: fn () callconv(.Async) void = func; | |
| 3 | var bytes: [64]u8 = undefined; | |
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | |
| 5 | } | |
| 6 | fn func() callconv(.Async) void {} | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=aarch64-linux-none | |
| 11 | // | |
| 12 | // tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8' |
test/cases/compile_errors/async/const_frame_cast_to_anyframe.zig created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | export fn a() void { | |
| 2 | const f = async func(); | |
| 3 | resume f; | |
| 4 | } | |
| 5 | export fn b() void { | |
| 6 | const f = async func(); | |
| 7 | var x: anyframe = &f; | |
| 8 | _ = x; | |
| 9 | } | |
| 10 | fn func() void { | |
| 11 | suspend {} | |
| 12 | } | |
| 13 | ||
| 14 | // error | |
| 15 | // backend=stage1 | |
| 16 | // target=native | |
| 17 | // | |
| 18 | // tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)' | |
| 19 | // tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)' |
test/cases/compile_errors/async/exported_async_function.zig created+7| ... | ... | @@ -0,0 +1,7 @@ |
| 1 | export fn foo() callconv(.Async) void {} | |
| 2 | ||
| 3 | // error | |
| 4 | // backend=stage1 | |
| 5 | // target=native | |
| 6 | // | |
| 7 | // tmp.zig:1:1: error: exported function cannot be async |
test/cases/compile_errors/async/frame_called_outside_of_function_definition.zig created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | var handle_undef: anyframe = undefined; | |
| 2 | var handle_dummy: anyframe = @frame(); | |
| 3 | export fn entry() bool { | |
| 4 | return handle_undef == handle_dummy; | |
| 5 | } | |
| 6 | ||
| 7 | // error | |
| 8 | // backend=stage1 | |
| 9 | // target=native | |
| 10 | // | |
| 11 | // tmp.zig:2:30: error: @frame() called outside of function definition |
test/cases/compile_errors/async/frame_causes_function_to_be_async.zig created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | export fn entry() void { | |
| 2 | func(); | |
| 3 | } | |
| 4 | fn func() void { | |
| 5 | _ = @frame(); | |
| 6 | } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 13 | // tmp.zig:5:9: note: @frame() causes function to be async |
test/cases/compile_errors/async/function_with_ccc_indirectly_calling_async_function.zig created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | export fn entry() void { | |
| 2 | foo(); | |
| 3 | } | |
| 4 | fn foo() void { | |
| 5 | bar(); | |
| 6 | } | |
| 7 | fn bar() void { | |
| 8 | suspend {} | |
| 9 | } | |
| 10 | ||
| 11 | // error | |
| 12 | // backend=stage1 | |
| 13 | // target=native | |
| 14 | // | |
| 15 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 16 | // tmp.zig:2:8: note: async function call here | |
| 17 | // tmp.zig:5:8: note: async function call here | |
| 18 | // tmp.zig:8:5: note: suspends here |
test/cases/compile_errors/async/indirect_recursion_of_async_functions_detected.zig created+36| ... | ... | @@ -0,0 +1,36 @@ |
| 1 | var frame: ?anyframe = null; | |
| 2 | ||
| 3 | export fn a() void { | |
| 4 | _ = async rangeSum(10); | |
| 5 | while (frame) |f| resume f; | |
| 6 | } | |
| 7 | ||
| 8 | fn rangeSum(x: i32) i32 { | |
| 9 | suspend { | |
| 10 | frame = @frame(); | |
| 11 | } | |
| 12 | frame = null; | |
| 13 | ||
| 14 | if (x == 0) return 0; | |
| 15 | var child = rangeSumIndirect(x - 1); | |
| 16 | return child + 1; | |
| 17 | } | |
| 18 | ||
| 19 | fn rangeSumIndirect(x: i32) i32 { | |
| 20 | suspend { | |
| 21 | frame = @frame(); | |
| 22 | } | |
| 23 | frame = null; | |
| 24 | ||
| 25 | if (x == 0) return 0; | |
| 26 | var child = rangeSum(x - 1); | |
| 27 | return child + 1; | |
| 28 | } | |
| 29 | ||
| 30 | // error | |
| 31 | // backend=stage1 | |
| 32 | // target=native | |
| 33 | // | |
| 34 | // tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself | |
| 35 | // tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here | |
| 36 | // tmp.zig:26:25: note: when analyzing type '@Frame(rangeSumIndirect)' here |
test/cases/compile_errors/async/invalid_suspend_in_exported_function.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame = async func(); | |
| 3 | var result = await frame; | |
| 4 | _ = result; | |
| 5 | } | |
| 6 | fn func() void { | |
| 7 | suspend {} | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 15 | // tmp.zig:3:18: note: await here is a suspend point |
test/cases/compile_errors/async/non-async_function_pointer_eventually_is_inferred_to_become_async.zig created+15| ... | ... | @@ -0,0 +1,15 @@ |
| 1 | export fn a() void { | |
| 2 | var non_async_fn: fn () void = undefined; | |
| 3 | non_async_fn = func; | |
| 4 | } | |
| 5 | fn func() void { | |
| 6 | suspend {} | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage1 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // tmp.zig:5:1: error: 'func' cannot be async | |
| 14 | // tmp.zig:3:20: note: required to be non-async here | |
| 15 | // tmp.zig:6:5: note: suspends here |
test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr = afunc; | |
| 3 | var bytes: [100]u8 align(16) = undefined; | |
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | |
| 5 | } | |
| 6 | fn afunc() void { } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:4:32: error: expected async function, found 'fn() void' |
test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | export fn a() void { | |
| 2 | var x: anyframe = undefined; | |
| 3 | var y: anyframe->i32 = x; | |
| 4 | _ = y; | |
| 5 | } | |
| 6 | export fn b() void { | |
| 7 | var x: i32 = undefined; | |
| 8 | var y: anyframe->i32 = x; | |
| 9 | _ = y; | |
| 10 | } | |
| 11 | export fn c() void { | |
| 12 | var x: @Frame(func) = undefined; | |
| 13 | var y: anyframe->i32 = &x; | |
| 14 | _ = y; | |
| 15 | } | |
| 16 | fn func() void {} | |
| 17 | ||
| 18 | // error | |
| 19 | // backend=stage1 | |
| 20 | // target=native | |
| 21 | // | |
| 22 | // :3:28: error: expected type 'anyframe->i32', found 'anyframe' | |
| 23 | // :8:28: error: expected type 'anyframe->i32', found 'i32' | |
| 24 | // tmp.zig:13:29: error: expected type 'anyframe->i32', found '*@Frame(func)' | |
| \ No newline at end of file |
test/cases/compile_errors/async/returning_error_from_void_async_function.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | return error.ShouldBeCompileError; | |
| 6 | } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}' |
test/cases/compile_errors/async/runtime-known_async_function_called.zig created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() void { | |
| 5 | var ptr = afunc; | |
| 6 | _ = ptr(); | |
| 7 | } | |
| 8 | fn afunc() callconv(.Async) void {} | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:6:12: error: function is not comptime-known; @asyncCall required |
test/cases/compile_errors/async/runtime-known_function_called_with_async_keyword.zig created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr = afunc; | |
| 3 | _ = async ptr(); | |
| 4 | } | |
| 5 | ||
| 6 | fn afunc() callconv(.Async) void { } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:3:15: error: function is not comptime-known; @asyncCall required |
test/cases/compile_errors/async/wrong_frame_type_used_for_async_call.zig created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame: @Frame(foo) = undefined; | |
| 3 | frame = async bar(); | |
| 4 | } | |
| 5 | fn foo() void { | |
| 6 | suspend {} | |
| 7 | } | |
| 8 | fn bar() void { | |
| 9 | suspend {} | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)' |
test/cases/compile_errors/async/wrong_type_for_argument_tuple_to_asyncCall.zig created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | export fn entry1() void { | |
| 2 | var frame: @Frame(foo) = undefined; | |
| 3 | @asyncCall(&frame, {}, foo, {}); | |
| 4 | } | |
| 5 | ||
| 6 | fn foo() i32 { | |
| 7 | return 0; | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:3:33: error: expected tuple or struct, found 'void' |
test/cases/compile_errors/async/wrong_type_for_result_ptr_to_asyncCall.zig created+16| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() i32 { | |
| 5 | var frame: @Frame(foo) = undefined; | |
| 6 | return await @asyncCall(&frame, false, foo, .{}); | |
| 7 | } | |
| 8 | fn foo() i32 { | |
| 9 | return 1234; | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:6:37: error: expected type '*i32', found 'bool' |
test/cases/compile_errors/stage1/obj/Frame_of_generic_function.zig deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame: @Frame(func) = undefined; | |
| 3 | _ = frame; | |
| 4 | } | |
| 5 | fn func(comptime T: type) void { | |
| 6 | var x: T = undefined; | |
| 7 | _ = x; | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:2:16: error: @Frame() of generic function |
test/cases/compile_errors/stage1/obj/async_function_depends_on_its_own_frame.zig deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | var x: [@sizeOf(@Frame(amain))]u8 = undefined; | |
| 6 | _ = x; | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage1 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // tmp.zig:4:1: error: cannot resolve '@Frame(amain)': function not fully analyzed yet |
test/cases/compile_errors/stage1/obj/async_function_indirectly_depends_on_its_own_frame.zig deleted-17| ... | ... | @@ -1,17 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | other(); | |
| 6 | } | |
| 7 | fn other() void { | |
| 8 | var x: [@sizeOf(@Frame(amain))]u8 = undefined; | |
| 9 | _ = x; | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:4:1: error: unable to determine async function frame of 'amain' | |
| 17 | // tmp.zig:5:10: note: analysis of function 'other' depends on the frame |
test/cases/compile_errors/stage1/obj/bad_alignment_in_asynccall.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr: fn () callconv(.Async) void = func; | |
| 3 | var bytes: [64]u8 = undefined; | |
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | |
| 5 | } | |
| 6 | fn func() callconv(.Async) void {} | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=aarch64-linux-none | |
| 11 | // | |
| 12 | // tmp.zig:4:21: error: expected type '[]align(8) u8', found '*[64]u8' |
test/cases/compile_errors/stage1/obj/const_frame_cast_to_anyframe.zig deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | export fn a() void { | |
| 2 | const f = async func(); | |
| 3 | resume f; | |
| 4 | } | |
| 5 | export fn b() void { | |
| 6 | const f = async func(); | |
| 7 | var x: anyframe = &f; | |
| 8 | _ = x; | |
| 9 | } | |
| 10 | fn func() void { | |
| 11 | suspend {} | |
| 12 | } | |
| 13 | ||
| 14 | // error | |
| 15 | // backend=stage1 | |
| 16 | // target=native | |
| 17 | // | |
| 18 | // tmp.zig:3:12: error: expected type 'anyframe', found '*const @Frame(func)' | |
| 19 | // tmp.zig:7:24: error: expected type 'anyframe', found '*const @Frame(func)' |
test/cases/compile_errors/stage1/obj/exported_async_function.zig deleted-7| ... | ... | @@ -1,7 +0,0 @@ |
| 1 | export fn foo() callconv(.Async) void {} | |
| 2 | ||
| 3 | // error | |
| 4 | // backend=stage1 | |
| 5 | // target=native | |
| 6 | // | |
| 7 | // tmp.zig:1:1: error: exported function cannot be async |
test/cases/compile_errors/stage1/obj/frame_called_outside_of_function_definition.zig deleted-11| ... | ... | @@ -1,11 +0,0 @@ |
| 1 | var handle_undef: anyframe = undefined; | |
| 2 | var handle_dummy: anyframe = @frame(); | |
| 3 | export fn entry() bool { | |
| 4 | return handle_undef == handle_dummy; | |
| 5 | } | |
| 6 | ||
| 7 | // error | |
| 8 | // backend=stage1 | |
| 9 | // target=native | |
| 10 | // | |
| 11 | // tmp.zig:2:30: error: @frame() called outside of function definition |
test/cases/compile_errors/stage1/obj/frame_causes_function_to_be_async.zig deleted-13| ... | ... | @@ -1,13 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | func(); | |
| 3 | } | |
| 4 | fn func() void { | |
| 5 | _ = @frame(); | |
| 6 | } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 13 | // tmp.zig:5:9: note: @frame() causes function to be async |
test/cases/compile_errors/stage1/obj/function_with_ccc_indirectly_calling_async_function.zig deleted-18| ... | ... | @@ -1,18 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | foo(); | |
| 3 | } | |
| 4 | fn foo() void { | |
| 5 | bar(); | |
| 6 | } | |
| 7 | fn bar() void { | |
| 8 | suspend {} | |
| 9 | } | |
| 10 | ||
| 11 | // error | |
| 12 | // backend=stage1 | |
| 13 | // target=native | |
| 14 | // | |
| 15 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 16 | // tmp.zig:2:8: note: async function call here | |
| 17 | // tmp.zig:5:8: note: async function call here | |
| 18 | // tmp.zig:8:5: note: suspends here |
test/cases/compile_errors/stage1/obj/indirect_recursion_of_async_functions_detected.zig deleted-36| ... | ... | @@ -1,36 +0,0 @@ |
| 1 | var frame: ?anyframe = null; | |
| 2 | ||
| 3 | export fn a() void { | |
| 4 | _ = async rangeSum(10); | |
| 5 | while (frame) |f| resume f; | |
| 6 | } | |
| 7 | ||
| 8 | fn rangeSum(x: i32) i32 { | |
| 9 | suspend { | |
| 10 | frame = @frame(); | |
| 11 | } | |
| 12 | frame = null; | |
| 13 | ||
| 14 | if (x == 0) return 0; | |
| 15 | var child = rangeSumIndirect(x - 1); | |
| 16 | return child + 1; | |
| 17 | } | |
| 18 | ||
| 19 | fn rangeSumIndirect(x: i32) i32 { | |
| 20 | suspend { | |
| 21 | frame = @frame(); | |
| 22 | } | |
| 23 | frame = null; | |
| 24 | ||
| 25 | if (x == 0) return 0; | |
| 26 | var child = rangeSum(x - 1); | |
| 27 | return child + 1; | |
| 28 | } | |
| 29 | ||
| 30 | // error | |
| 31 | // backend=stage1 | |
| 32 | // target=native | |
| 33 | // | |
| 34 | // tmp.zig:8:1: error: '@Frame(rangeSum)' depends on itself | |
| 35 | // tmp.zig:15:33: note: when analyzing type '@Frame(rangeSum)' here | |
| 36 | // tmp.zig:26:25: note: when analyzing type '@Frame(rangeSumIndirect)' here |
test/cases/compile_errors/stage1/obj/invalid_suspend_in_exported_function.zig deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame = async func(); | |
| 3 | var result = await frame; | |
| 4 | _ = result; | |
| 5 | } | |
| 6 | fn func() void { | |
| 7 | suspend {} | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:1:1: error: function with calling convention 'C' cannot be async | |
| 15 | // tmp.zig:3:18: note: await here is a suspend point |
test/cases/compile_errors/stage1/obj/non-async_function_pointer_eventually_is_inferred_to_become_async.zig deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | export fn a() void { | |
| 2 | var non_async_fn: fn () void = undefined; | |
| 3 | non_async_fn = func; | |
| 4 | } | |
| 5 | fn func() void { | |
| 6 | suspend {} | |
| 7 | } | |
| 8 | ||
| 9 | // error | |
| 10 | // backend=stage1 | |
| 11 | // target=native | |
| 12 | // | |
| 13 | // tmp.zig:5:1: error: 'func' cannot be async | |
| 14 | // tmp.zig:3:20: note: required to be non-async here | |
| 15 | // tmp.zig:6:5: note: suspends here |
test/cases/compile_errors/stage1/obj/non_async_function_pointer_passed_to_asyncCall.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr = afunc; | |
| 3 | var bytes: [100]u8 align(16) = undefined; | |
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | |
| 5 | } | |
| 6 | fn afunc() void { } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:4:32: error: expected async function, found 'fn() void' |
test/cases/compile_errors/stage1/obj/prevent_bad_implicit_casting_of_anyframe_types.zig deleted-24| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | export fn a() void { | |
| 2 | var x: anyframe = undefined; | |
| 3 | var y: anyframe->i32 = x; | |
| 4 | _ = y; | |
| 5 | } | |
| 6 | export fn b() void { | |
| 7 | var x: i32 = undefined; | |
| 8 | var y: anyframe->i32 = x; | |
| 9 | _ = y; | |
| 10 | } | |
| 11 | export fn c() void { | |
| 12 | var x: @Frame(func) = undefined; | |
| 13 | var y: anyframe->i32 = &x; | |
| 14 | _ = y; | |
| 15 | } | |
| 16 | fn func() void {} | |
| 17 | ||
| 18 | // error | |
| 19 | // backend=stage1 | |
| 20 | // target=native | |
| 21 | // | |
| 22 | // :3:28: error: expected type 'anyframe->i32', found 'anyframe' | |
| 23 | // :8:28: error: expected type 'anyframe->i32', found 'i32' | |
| 24 | // tmp.zig:13:29: error: expected type 'anyframe->i32', found '*@Frame(func)' | |
| \ No newline at end of file |
test/cases/compile_errors/stage1/obj/returning_error_from_void_async_function.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() callconv(.Async) void { | |
| 5 | return error.ShouldBeCompileError; | |
| 6 | } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:5:17: error: expected type 'void', found 'error{ShouldBeCompileError}' |
test/cases/compile_errors/stage1/obj/runtime-known_async_function_called.zig deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() void { | |
| 5 | var ptr = afunc; | |
| 6 | _ = ptr(); | |
| 7 | } | |
| 8 | fn afunc() callconv(.Async) void {} | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:6:12: error: function is not comptime-known; @asyncCall required |
test/cases/compile_errors/stage1/obj/runtime-known_function_called_with_async_keyword.zig deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var ptr = afunc; | |
| 3 | _ = async ptr(); | |
| 4 | } | |
| 5 | ||
| 6 | fn afunc() callconv(.Async) void { } | |
| 7 | ||
| 8 | // error | |
| 9 | // backend=stage1 | |
| 10 | // target=native | |
| 11 | // | |
| 12 | // tmp.zig:3:15: error: function is not comptime-known; @asyncCall required |
test/cases/compile_errors/stage1/obj/wrong_frame_type_used_for_async_call.zig deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | var frame: @Frame(foo) = undefined; | |
| 3 | frame = async bar(); | |
| 4 | } | |
| 5 | fn foo() void { | |
| 6 | suspend {} | |
| 7 | } | |
| 8 | fn bar() void { | |
| 9 | suspend {} | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:3:13: error: expected type '*@Frame(bar)', found '*@Frame(foo)' |
test/cases/compile_errors/stage1/obj/wrong_type_for_argument_tuple_to_asyncCall.zig deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | export fn entry1() void { | |
| 2 | var frame: @Frame(foo) = undefined; | |
| 3 | @asyncCall(&frame, {}, foo, {}); | |
| 4 | } | |
| 5 | ||
| 6 | fn foo() i32 { | |
| 7 | return 0; | |
| 8 | } | |
| 9 | ||
| 10 | // error | |
| 11 | // backend=stage1 | |
| 12 | // target=native | |
| 13 | // | |
| 14 | // tmp.zig:3:33: error: expected tuple or struct, found 'void' |
test/cases/compile_errors/stage1/obj/wrong_type_for_result_ptr_to_asyncCall.zig deleted-16| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | export fn entry() void { | |
| 2 | _ = async amain(); | |
| 3 | } | |
| 4 | fn amain() i32 { | |
| 5 | var frame: @Frame(foo) = undefined; | |
| 6 | return await @asyncCall(&frame, false, foo, .{}); | |
| 7 | } | |
| 8 | fn foo() i32 { | |
| 9 | return 1234; | |
| 10 | } | |
| 11 | ||
| 12 | // error | |
| 13 | // backend=stage1 | |
| 14 | // target=native | |
| 15 | // | |
| 16 | // tmp.zig:6:37: error: expected type '*i32', found 'bool' |