aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/uncreachable_else_prong_err_set.zig
blob: 4b0ae462d6041943387f8cbca37367e7670ed5a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
pub export fn complex() void {
    var a: error{ Foo, Bar } = error.Foo;
    switch (a) {
        error.Foo => unreachable,
        error.Bar => unreachable,
        else => {
            @compileError("<something complex here>");
        },
    }
}

pub export fn simple() void {
    var a: error{ Foo, Bar } = error.Foo;
    switch (a) {
        error.Foo => unreachable,
        error.Bar => unreachable,
        else => |e| return e,
    }
}

// error
// backend=llvm
// target=native
//
// :6:14: error: unreachable else prong; all cases already handled