aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors/switch_ranges_endpoints_are_validated.zig
blob: 753a1523ff070655058872eba00d3ff3ab90932d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
pub export fn entry1() void {
    const x: i32 = 0;
    switch (x) {
        6...1 => {},
        else => unreachable,
    }
}
pub export fn entr2() void {
    const x: i32 = 0;
    switch (x) {
        -1...-5 => {},
        else => unreachable,
    }
}

// error
//
// :4:10: error: range start value is greater than the end value
// :11:11: error: range start value is greater than the end value