authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-25 11:51:40+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-03-25 22:30:35+02:00
loga4c5ec49f1781054ef9394fe114e4338ed9970d4
treee9eae84685bb5432a76b65189614dcc93a985710
parent9a127501f68d6034367094915ad53e8d57495786

Sema: add error for empty switch


1 files changed, 3 insertions(+), 0 deletions(-)

src/Sema.zig+3
...@@ -7743,6 +7743,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError...@@ -7743,6 +7743,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
7743 }7743 }
77447744
7745 if (scalar_cases_len + multi_cases_len == 0) {7745 if (scalar_cases_len + multi_cases_len == 0) {
7746 if (special_prong == .none) {
7747 return sema.fail(block, src, "switch must handle all possibilities", .{});
7748 }
7746 return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges);7749 return sema.resolveBlockBody(block, src, &child_block, special.body, inst, merges);
7747 }7750 }
77487751