aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-08-02 17:29:31 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-08-02 17:29:31 -0400
commit65140b2fba4e55d713de506f2bed259ca9410cbf (patch)
treee52660c1726caabc730c8869499e5801f027f1b1 /test/compile_errors.zig
parent951124e1772c7013c2b1a674cf98a0b638c36262 (diff)
parentfb05b96492f4fb1476106bf735788ac16f69c7ef (diff)
downloadzig-65140b2fba4e55d713de506f2bed259ca9410cbf.tar.gz
zig-65140b2fba4e55d713de506f2bed259ca9410cbf.zip
Merge remote-tracking branch 'origin/master' into async-fs
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig25
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 {
\\ }
\\ }
\\}