Sema: fix single-range switch prong capture (for real this time)

e2338edb47 didn't *quite* do it, the call sites of all switch prong related
functions now have to do their part too and be a little more precise about
what kind of prong they're currently analyzing.

Also removes some unused/unnecessary stuff.
This commit is contained in:
Justus Klausecker 2026-01-12 19:59:47 +01:00 committed by Alex Rønne Petersen
parent 4fcf6507f9
commit 044ba3e0b0
3 changed files with 70 additions and 74 deletions

View file

@ -1308,7 +1308,7 @@ test "single-item prong in switch on enum has comptime-known capture" {
try comptime E.doTheTest(.a);
}
test "single-range switch prong capture" {
test "single range switch prong capture" {
const S = struct {
fn doTheTest(x: u8) !void {
switch (x) {
@ -1317,6 +1317,12 @@ test "single-range switch prong capture" {
},
else => return error.TestFailed,
}
switch (x) {
1...5, 6 => |val| {
try expect(val == 2);
},
else => return error.TestFailed,
}
}
};
try S.doTheTest(2);