Emit error when range pattern is empty
I couldn't find a cleaner way to get values of upper and lower bound. Tell me if there is a better way to get those values. @CohenArthur @P-E-P
I'm unsure this should be done at this stage of the compiler, this surely is simpler after a bit of desugaring. Have you taken a look at rustc's way of doing this ? Is it doing it this early ?
https://godbolt.org/z/sThP53WbG
pub fn main() {
let _a = 1..=0;
match 0 {
1..=0 => {},
_ => {}
}
let (1..=0, _b) = (1, 0);
}
It looks like the error only happens in match-like statements (the first line of the main function does not produce an error with rustc 1.49)
I wonder if that is the intended behaviour. I will ask in rustc if this is what they want or a missed case.
I'm unsure this should be done at this stage of the compiler, this surely is simpler after a bit of desugaring. Have you taken a look at rustc's way of doing this ? Is it doing it this early ?
you are right, rustc actually handles this error in typed-hir stage.
@braw-lee do you want some help on moving this to the typechecking phase?