2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-05-23 23:29:12 -05:00
|
|
|
// Test that type inference for range patterns works correctly (is bi-directional).
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
match 1 {
|
2018-05-28 21:42:11 -05:00
|
|
|
1 ..= 3 => {}
|
2015-05-23 23:29:12 -05:00
|
|
|
_ => panic!("should match range")
|
|
|
|
}
|
|
|
|
match 1 {
|
2018-05-28 21:42:11 -05:00
|
|
|
1 ..= 3u16 => {}
|
2015-05-23 23:29:12 -05:00
|
|
|
_ => panic!("should match range with inferred start type")
|
|
|
|
}
|
|
|
|
match 1 {
|
2018-05-28 21:42:11 -05:00
|
|
|
1u16 ..= 3 => {}
|
2015-05-23 23:29:12 -05:00
|
|
|
_ => panic!("should match range with inferred end type")
|
|
|
|
}
|
|
|
|
}
|