diff options
author | Florian Diebold <[email protected]> | 2020-01-17 15:59:02 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-01-17 15:59:51 +0000 |
commit | 33d637f2ddb5e5eab6d5dfaf75042dfc1a58d241 (patch) | |
tree | 52d96e64a1235e3b22d5ed8e213a7b616d115aba /crates/ra_hir_ty/src/infer | |
parent | 07dca1123dfaec527c6ba3164125309f5c4cc3db (diff) |
Fix inference for shift operators
Fixes #2602.
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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> { | |||
386 | let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); | 386 | let lhs_ty = self.infer_expr(*lhs, &lhs_expectation); |
387 | // FIXME: find implementation of trait corresponding to operation | 387 | // FIXME: find implementation of trait corresponding to operation |
388 | // symbol and resolve associated `Output` type | 388 | // symbol and resolve associated `Output` type |
389 | let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty); | 389 | let rhs_expectation = op::binary_op_rhs_expectation(*op, lhs_ty.clone()); |
390 | let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); | 390 | let rhs_ty = self.infer_expr(*rhs, &Expectation::has_type(rhs_expectation)); |
391 | 391 | ||
392 | // FIXME: similar as above, return ty is often associated trait type | 392 | // FIXME: similar as above, return ty is often associated trait type |
393 | op::binary_op_return_ty(*op, rhs_ty) | 393 | op::binary_op_return_ty(*op, lhs_ty, rhs_ty) |
394 | } | 394 | } |
395 | _ => Ty::Unknown, | 395 | _ => Ty::Unknown, |
396 | }, | 396 | }, |