| author | |
| committer | |
| log | 2826f78a61c014b7cfb9e7ce1a7efce31b24d0c9 |
| tree | c002d065f4565e044ebc91be62a9642473c8b6ec |
| parent | bde6e075dfc202fdcfa21ec9c2d90941460b002e |
| signature |
3 files changed, 9 insertions(+), 0 deletions(-)
src/Sema.zig+7| ... | ... | @@ -10791,6 +10791,13 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 10791 | 10791 | "'_' prong here", |
| 10792 | 10792 | .{}, |
| 10793 | 10793 | ); |
| 10794 | try sema.errNote( | |
| 10795 | block, | |
| 10796 | src, | |
| 10797 | msg, | |
| 10798 | "consider using 'else'", | |
| 10799 | .{}, | |
| 10800 | ); | |
| 10794 | 10801 | break :msg msg; |
| 10795 | 10802 | }; |
| 10796 | 10803 | return sema.failWithOwnedErrorMsg(msg); |
test/cases/compile_errors/switching_with_exhaustive_enum_has___prong_.zig+1| ... | ... | @@ -17,3 +17,4 @@ pub export fn entry() void { |
| 17 | 17 | // |
| 18 | 18 | // :7:5: error: '_' prong only allowed when switching on non-exhaustive enums |
| 19 | 19 | // :10:11: note: '_' prong here |
| 20 | // :7:5: note: consider using 'else' |
test/cases/compile_errors/switching_with_non-exhaustive_enums.zig+1| ... | ... | @@ -40,3 +40,4 @@ pub export fn entry3() void { |
| 40 | 40 | // :19:5: error: switch on non-exhaustive enum must include 'else' or '_' prong |
| 41 | 41 | // :26:5: error: '_' prong only allowed when switching on non-exhaustive enums |
| 42 | 42 | // :29:11: note: '_' prong here |
| 43 | // :26:5: note: consider using 'else' |