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