#zig build-obj {
--name test -fno-emit-bin
-Mroot=test.zig
#}

#write test.zig {
const E = enum(u8) {
    a,
    b,
    _,
};
const U = union(E) {
    a,
    b,
};
fn foo() U {
    return undefined;
}

export fn entry1() void {
    const u = foo();
    switch (u) {
        .a => {},
    }
}
export fn entry2() void {
    const u = foo();
    switch (u) {
        .a => {},
        .b => {},
        else => {},
    }
}
export fn entry3() void {
    const u = foo();
    switch (u) {
        .a => {},
        .b => {},
        _ => {},
    }
}
export fn entry4() void {
    const u = foo();
    switch (u) {
        .a => {},
        else => {},
        _ => {},
    }
}
#}
#update
#check errors {
test.zig:16:5: error: switch must handle all possibilities
test.zig:3:5: note: unhandled enumeration value: 'b'
test.zig:1:11: note: enum 'test.E' declared here
test.zig:25:14: error: unreachable else prong; all cases already handled
test.zig:30:5: error: '_' prong only allowed when switching on non-exhaustive enums
test.zig:33:9: note: '_' prong here
test.zig:30:5: note: consider using 'else'
test.zig:38:5: error: '_' prong only allowed when switching on non-exhaustive enums
test.zig:41:9: note: '_' prong here
test.zig:38:5: note: consider using 'else'
#}
