master
1export fn a() void {
2 while (true) : (bad()) {}
3}
4export fn b() void {
5 var x: anyerror!i32 = 1234;
6 _ = &x;
7 while (x) |_| : (bad()) {} else |_| {}
8}
9export fn c() void {
10 var x: ?i32 = 1234;
11 _ = &x;
12 while (x) |_| : (bad()) {}
13}
14fn bad() anyerror!void {
15 return error.Bad;
16}
17
18export fn d() void {
19 while (true) : (bad2()) {}
20}
21fn bad2() anyerror {
22 return error.Bad;
23}
24
25// error
26//
27// :2:24: error: error union is ignored
28// :2:24: note: consider using 'try', 'catch', or 'if'
29// :7:25: error: error union is ignored
30// :7:25: note: consider using 'try', 'catch', or 'if'
31// :12:25: error: error union is ignored
32// :12:25: note: consider using 'try', 'catch', or 'if'
33// :19:25: error: error set is ignored