aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorkristopher tate <kt@connectfree.co.jp>2018-07-28 23:52:12 +0900
committerkristopher tate <kt@connectfree.co.jp>2018-08-02 16:50:08 +0900
commit13ec5db2348a0f6a4464aa8a513dbf11b72dc3ae (patch)
tree7754d65bd7b62946044a6ac0e6f398c40119ad43 /test/compile_errors.zig
parentc546f750f14e63b80c01d707c5559524313edfe4 (diff)
downloadzig-13ec5db2348a0f6a4464aa8a513dbf11b72dc3ae.tar.gz
zig-13ec5db2348a0f6a4464aa8a513dbf11b72dc3ae.zip
test/compile_errors.zig: @handle() in non-async function
Tracking Issue #1296 ;
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index c34b325a78..241f3a47a8 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -4754,4 +4754,18 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
,
".tmp_source.zig:6:29: error: @handle() called outside of function definition",
);
+
+ cases.add(
+ "@handle() in non-async function",
+ \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
+ \\ @import("std").os.exit(126);
+ \\}
+ \\
+ \\pub fn main() void {
+ \\ var handle_undef: promise = undefined;
+ \\ if (handle_undef == @handle()) return 0;
+ \\}
+ ,
+ ".tmp_source.zig:7:25: error: @handle() in non-async function",
+ );
}