From 33d637f2ddb5e5eab6d5dfaf75042dfc1a58d241 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 17 Jan 2020 16:59:02 +0100 Subject: Fix inference for shift operators Fixes #2602. --- crates/ra_hir_ty/src/tests/simple.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'crates/ra_hir_ty/src/tests') diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index f7e042c12..b7204ec00 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs @@ -613,6 +613,27 @@ fn test() -> bool { ); } +#[test] +fn infer_shift_op() { + assert_snapshot!( + infer(r#" +fn test() { + 1u32 << 5u8; + 1u32 >> 5u8; +} +"#), + @r###" + [11; 48) '{ ...5u8; }': () + [17; 21) '1u32': u32 + [17; 28) '1u32 << 5u8': u32 + [25; 28) '5u8': u8 + [34; 38) '1u32': u32 + [34; 45) '1u32 >> 5u8': u32 + [42; 45) '5u8': u8 + "### + ); +} + #[test] fn infer_field_autoderef() { assert_snapshot!( -- cgit v1.2.3