aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/unreachable_else_prong_err_set.zig
blob: 7a2583f5a3a148dbd0a0e0760e804fbf7960c632 (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;
    _ = &a;
    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;
    _ = &a;
    switch (a) {
        error.Foo => unreachable,
        error.Bar => unreachable,
        else => |e| return e,
    }
}

// error
//
// :7:14: error: unreachable else prong; all cases already handled