aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAlexandros Naskos <alex_naskos@hotmail.com>2020-06-24 16:56:24 +0300
committerAlexandros Naskos <alex_naskos@hotmail.com>2020-06-24 16:56:24 +0300
commiteefcd044628ea080d8fe3346ae4d01e8ed4008e6 (patch)
treee7d81544fc762133e142146515bfc477d7ec0580 /test/compile_errors.zig
parent50b70bd77f31bba6ffca33b6acb90186e739118e (diff)
downloadzig-eefcd044628ea080d8fe3346ae4d01e8ed4008e6.tar.gz
zig-eefcd044628ea080d8fe3346ae4d01e8ed4008e6.zip
Small fixes, fixed tests, added test for argument tuple type
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig19
1 files changed, 16 insertions, 3 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index e8b7e610ee..90c970c842 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1144,13 +1144,26 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:2:15: error: @Type not available for 'TypeInfo.Struct'",
});
+ cases.add("wrong type for argument tuple to @asyncCall",
+ \\export fn entry1() void {
+ \\ var frame: @Frame(foo) = undefined;
+ \\ @asyncCall(&frame, {}, foo, {});
+ \\}
+ \\
+ \\fn foo() i32 {
+ \\ return 0;
+ \\}
+ , &[_][]const u8{
+ "tmp.zig:3:33: error: expected tuple or struct, found 'void'",
+ });
+
cases.add("wrong type for result ptr to @asyncCall",
\\export fn entry() void {
\\ _ = async amain();
\\}
\\fn amain() i32 {
\\ var frame: @Frame(foo) = undefined;
- \\ return await @asyncCall(&frame, false, foo);
+ \\ return await @asyncCall(&frame, false, foo, .{});
\\}
\\fn foo() i32 {
\\ return 1234;
@@ -1291,7 +1304,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
\\export fn entry() void {
\\ var ptr: fn () callconv(.Async) void = func;
\\ var bytes: [64]u8 = undefined;
- \\ _ = @asyncCall(&bytes, {}, ptr);
+ \\ _ = @asyncCall(&bytes, {}, ptr, .{});
\\}
\\fn func() callconv(.Async) void {}
, &[_][]const u8{
@@ -1467,7 +1480,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
\\export fn entry() void {
\\ var ptr = afunc;
\\ var bytes: [100]u8 align(16) = undefined;
- \\ _ = @asyncCall(&bytes, {}, ptr);
+ \\ _ = @asyncCall(&bytes, {}, ptr, .{});
\\}
\\fn afunc() void { }
, &[_][]const u8{