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