aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 0ad6787552..1bca093e79 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -1,6 +1,17 @@
const tests = @import("tests.zig");
pub fn addCases(cases: &tests.CompileErrorContext) void {
+ cases.add("returning error from void async function",
+ \\const std = @import("std");
+ \\export fn entry() void {
+ \\ const p = async(std.debug.global_allocator) amain() catch unreachable;
+ \\}
+ \\async fn amain() void {
+ \\ return error.ShouldBeCompileError;
+ \\}
+ ,
+ ".tmp_source.zig:6:17: error: expected type 'void', found 'error{ShouldBeCompileError}'");
+
cases.add("var not allowed in structs",
\\export fn entry() void {
\\ var s = (struct{v: var}){.v=i32(10)};