aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorkristopher tate <kt@connectfree.co.jp>2018-07-28 23:51:48 +0900
committerkristopher tate <kt@connectfree.co.jp>2018-08-02 16:50:08 +0900
commitc546f750f14e63b80c01d707c5559524313edfe4 (patch)
tree0421b69921a8ba360d61c34d69e72842e342a9e4 /test/compile_errors.zig
parent104bdb03d6b5906716efeb84045079a424bf650a (diff)
downloadzig-c546f750f14e63b80c01d707c5559524313edfe4.tar.gz
zig-c546f750f14e63b80c01d707c5559524313edfe4.zip
test/compile_errors.zig: @handle() called outside of function definition;
Tracking Issue #1296 ;
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 2c4c9208eb..c34b325a78 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -4738,4 +4738,20 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
,
".tmp_source.zig:3:36: error: @ArgType could not resolve the type of arg 0 because 'fn(var)var' is generic",
);
+
+ cases.add(
+ "@handle() called outside of function definition",
+ \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn {
+ \\ @import("std").os.exit(126);
+ \\}
+ \\
+ \\var handle_undef: promise = undefined;
+ \\var handle_dummy: promise = @handle();
+ \\
+ \\pub fn main() void {
+ \\ if (handle_undef == handle_dummy) return 0;
+ \\}
+ ,
+ ".tmp_source.zig:6:29: error: @handle() called outside of function definition",
+ );
}