diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-08-31 00:40:59 +0100 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-09-01 18:31:01 +0100 |
| commit | 2b9af9e825fcbfd55f953e7c3bc80decb52a4b2b (patch) | |
| tree | fcb27173da478ec2bdbb412b3d75cccb93bfeab6 /lib/std | |
| parent | b7a55cd6c3ca0c4c97f266b72f741b980416456a (diff) | |
| download | zig-2b9af9e825fcbfd55f953e7c3bc80decb52a4b2b.tar.gz zig-2b9af9e825fcbfd55f953e7c3bc80decb52a4b2b.zip | |
AstGen: error on unused switch label
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/zig/AstGen.zig | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index b280360535..aa1ea2498f 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -7999,6 +7999,11 @@ fn switchExpr( appendBodyWithFixupsArrayList(astgen, payloads, case_slice); } } + + if (switch_full.label_token) |label_token| if (!block_scope.label.?.used) { + try astgen.appendErrorTok(label_token, "unused switch label", .{}); + }; + // Now that the item expressions are generated we can add this. try parent_gz.instructions.append(gpa, switch_block); |
