Skip to content

Commit

Permalink
Adjust tests to be clearer about the type that results from a shift e…
Browse files Browse the repository at this point in the history
…xpression.
  • Loading branch information
nikomatsakis committed Jan 8, 2015
1 parent 705b92b commit a661bd6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/test/compile-fail/shift-various-bad-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
20 changes: 10 additions & 10 deletions src/test/run-pass/shift-various-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

5 comments on commit a661bd6

@bors
Copy link
Contributor

@bors bors commented on a661bd6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from aturon
at nikomatsakis@a661bd6

@bors
Copy link
Contributor

@bors bors commented on a661bd6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nikomatsakis/rust/int-feature = a661bd65 into auto

@bors
Copy link
Contributor

@bors bors commented on a661bd6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "81e6142030bc9a648a83ebb2333e38a831e5de16"}

@bors
Copy link
Contributor

@bors bors commented on a661bd6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nikomatsakis/rust/int-feature = a661bd65 merged ok, testing candidate = 81e61420

@bors
Copy link
Contributor

@bors bors commented on a661bd6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.