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