master
1const builtin = @import("builtin");
2const A = error{
3 FileNotFound,
4 NotDir,
5};
6const B = error{OutOfMemory};
7
8const C = A || B;
9
10fn foo() C!void {
11 return error.NotDir;
12}
13
14test "merge error sets" {
15 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
16
17 if (foo()) {
18 @panic("unexpected");
19 } else |err| switch (err) {
20 error.OutOfMemory => @panic("unexpected"),
21 error.FileNotFound => @panic("unexpected"),
22 error.NotDir => {},
23 }
24}