master
1const Error = error{
2 One,
3 Two,
4 Three,
5 Four,
6};
7fn f(n: Error!i32) i32 {
8 if (n) |x| x else |e| switch (e) {
9 error.One => 1,
10 error.Two => 2,
11 error.Three => 3,
12 }
13}
14fn h(n: Error!i32) i32 {
15 n catch |e| switch (e) {
16 error.One => 1,
17 error.Two => 2,
18 error.Three => 3,
19 };
20}
21
22export fn entry() usize {
23 return @sizeOf(@TypeOf(&f)) + @sizeOf(@TypeOf(&h));
24}
25
26// error
27//
28// :8:27: error: switch must handle all possibilities
29// :8:27: note: unhandled error value: 'error.Four'
30// :15:17: error: switch must handle all possibilities
31// :15:17: note: unhandled error value: 'error.Four'