fix missing compile error for returning error from void async function

closes #799
This commit is contained in:
Andrew Kelley
2018-03-06 21:44:27 -05:00
parent 6b5cfd9d99
commit d96dd5bc32
3 changed files with 39 additions and 29 deletions

View File

@@ -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)};