aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/nested_error_set_mismatch.zig
blob: c0d68a5e5385244faaaf41d3d0bdb3de6b30d4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const NextError = error{NextError};
const OtherError = error{OutOfMemory};

export fn entry() void {
    const a: ?NextError!i32 = foo();
    _ = a;
}

fn foo() ?OtherError!i32 {
    return null;
}

// error
// backend=llvm
// target=native
//
// :4:1: error: expected type '?error{NextError}!i32', found '?error{OutOfMemory}!i32'
// :4:1: note: optional type child 'error{OutOfMemory}!i32' cannot cast into optional type child 'error{NextError}!i32'
// :4:1: note: 'error.OutOfMemory' not a member of destination error set