master
1const A = error{
2 NotDir,
3
4 /// A doc comment
5 PathNotFound,
6};
7const B = error{
8 OutOfMemory,
9
10 /// B doc comment
11 PathNotFound,
12};
13
14const C = A || B;
15
16fn foo() C!void {
17 return error.NotDir;
18}
19
20test "merge error sets" {
21 if (foo()) {
22 @panic("unexpected");
23 } else |err| switch (err) {
24 error.OutOfMemory => @panic("unexpected"),
25 error.PathNotFound => @panic("unexpected"),
26 error.NotDir => {},
27 }
28}
29
30// test