diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-02 14:16:46 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-02 14:16:46 -0400 |
| commit | fb05b96492f4fb1476106bf735788ac16f69c7ef (patch) | |
| tree | 14ec51f41d29214e550317f283aa8dcdbf223b9d /test/compile_errors.zig | |
| parent | 9ecbabfc4ce857e43db2b056bc83272cb24b0bbd (diff) | |
| parent | 895f262a55b9951647efef4528c17cf64d6b7c07 (diff) | |
| download | zig-fb05b96492f4fb1476106bf735788ac16f69c7ef.tar.gz zig-fb05b96492f4fb1476106bf735788ac16f69c7ef.zip | |
Merge branch 'kristate-handle-builtin-issue1296'
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 2c4c9208eb..948d212e58 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,27 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "@handle() called outside of function definition", + \\var handle_undef: promise = undefined; + \\var handle_dummy: promise = @handle(); + \\export fn entry() bool { + \\ return handle_undef == handle_dummy; + \\} + , + ".tmp_source.zig:2:29: error: @handle() called outside of function definition", + ); + + cases.add( + "@handle() in non-async function", + \\export fn entry() bool { + \\ var handle_undef: promise = undefined; + \\ return handle_undef == @handle(); + \\} + , + ".tmp_source.zig:3:28: error: @handle() in non-async function", + ); + + cases.add( "while loop body expression ignored", \\fn returns() usize { \\ return 2; @@ -367,8 +388,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} \\ \\async fn foo() void { - \\ suspend |p| { - \\ suspend |p1| { + \\ suspend { + \\ suspend { \\ } \\ } \\} |
