aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/bugs/11046.zig
blob: 4fcd33deb431c54b274128c21d054eb05df01777 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const builtin = @import("builtin");

fn foo() !void {
    var a = true;
    if (a) return error.Foo;
    return error.Bar;
}
fn bar() !void {
    try foo();
}

test "fixed" {
    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
    if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO

    bar() catch |err| switch (err) {
        error.Foo => {}, // error: expected (inferred error set of bar), found error{Foo}
        error.Bar => {},
    };
}