Adjust tests to be clearer about the type that results from a shift expression.

This commit is contained in:
Niko Matsakis 2015-01-08 11:26:42 -05:00
parent 705b92bdfe
commit a661bd6575
2 changed files with 14 additions and 10 deletions

View File

@ -33,6 +33,10 @@ fn foo(p: &Panolpy) {
22 >> 1;
// Integer literal types are OK
// Type of the result follows the LHS, not the RHS:
let _: i32 = 22_i64 >> 1_i32;
//~^ ERROR mismatched types: expected `i32`, found `i64`
}
fn main() {

View File

@ -25,17 +25,17 @@ struct Panolpy {
}
fn foo(p: &Panolpy) {
assert_eq!(22 >> p.i8, 11_i8);
assert_eq!(22 >> p.i16, 11_i16);
assert_eq!(22 >> p.i32, 11_i32);
assert_eq!(22 >> p.i64, 11_i64);
assert_eq!(22 >> p.isize, 11_is);
assert_eq!(22_i32 >> p.i8, 11_i32);
assert_eq!(22_i32 >> p.i16, 11_i32);
assert_eq!(22_i32 >> p.i32, 11_i32);
assert_eq!(22_i32 >> p.i64, 11_i32);
assert_eq!(22_i32 >> p.isize, 11_i32);
assert_eq!(22 >> p.u8, 11_u8);
assert_eq!(22 >> p.u16, 11_u16);
assert_eq!(22 >> p.u32, 11_u32);
assert_eq!(22 >> p.u64, 11_u64);
assert_eq!(22 >> p.usize, 11_us);
assert_eq!(22_i32 >> p.u8, 11_i32);
assert_eq!(22_i32 >> p.u16, 11_i32);
assert_eq!(22_i32 >> p.u32, 11_i32);
assert_eq!(22_i32 >> p.u64, 11_i32);
assert_eq!(22_i32 >> p.usize, 11_i32);
}
fn main() {