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/infer/expr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_ty/src/infer') diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index d6a17e469..31259a01d 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs @@ -386,11 +386,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); // FIXME: find implementation of trait corresponding to operation // symbol and resolve associated `Output` type - let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); + let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty.clone()); let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); // FIXME: similar as above, return ty is often associated trait type - op::binary_op_return_ty(*op, rhs_ty) + op::binary_op_return_ty(*op, lhs_ty, rhs_ty) } _ => Ty::Unknown, }, -- cgit v1.2.3