diff options
Diffstat (limited to 'crates/ra_hir_ty/src/infer/expr.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 0af94ae32..9d5f75625 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -35,8 +35,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
35 | TypeMismatch { expected: expected.ty.clone(), actual: ty.clone() }, | 35 | TypeMismatch { expected: expected.ty.clone(), actual: ty.clone() }, |
36 | ); | 36 | ); |
37 | } | 37 | } |
38 | let ty = self.resolve_ty_as_possible(ty); | 38 | self.resolve_ty_as_possible(ty) |
39 | ty | ||
40 | } | 39 | } |
41 | 40 | ||
42 | /// Infer type of expression with possibly implicit coerce to the expected type. | 41 | /// Infer type of expression with possibly implicit coerce to the expected type. |
@@ -155,8 +154,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
155 | }; | 154 | }; |
156 | self.register_obligations_for_call(&callee_ty); | 155 | self.register_obligations_for_call(&callee_ty); |
157 | self.check_call_arguments(args, ¶m_tys); | 156 | self.check_call_arguments(args, ¶m_tys); |
158 | let ret_ty = self.normalize_associated_types_in(ret_ty); | 157 | self.normalize_associated_types_in(ret_ty) |
159 | ret_ty | ||
160 | } | 158 | } |
161 | Expr::MethodCall { receiver, args, method_name, generic_args } => self | 159 | Expr::MethodCall { receiver, args, method_name, generic_args } => self |
162 | .infer_method_call(tgt_expr, *receiver, &args, &method_name, generic_args.as_ref()), | 160 | .infer_method_call(tgt_expr, *receiver, &args, &method_name, generic_args.as_ref()), |
@@ -280,14 +278,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
280 | } | 278 | } |
281 | Expr::Await { expr } => { | 279 | Expr::Await { expr } => { |
282 | let inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); | 280 | let inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); |
283 | let ty = | 281 | self.resolve_associated_type(inner_ty, self.resolve_future_future_output()) |
284 | self.resolve_associated_type(inner_ty, self.resolve_future_future_output()); | ||
285 | ty | ||
286 | } | 282 | } |
287 | Expr::Try { expr } => { | 283 | Expr::Try { expr } => { |
288 | let inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); | 284 | let inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); |
289 | let ty = self.resolve_associated_type(inner_ty, self.resolve_ops_try_ok()); | 285 | self.resolve_associated_type(inner_ty, self.resolve_ops_try_ok()) |
290 | ty | ||
291 | } | 286 | } |
292 | Expr::Cast { expr, type_ref } => { | 287 | Expr::Cast { expr, type_ref } => { |
293 | let _inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); | 288 | let _inner_ty = self.infer_expr_inner(*expr, &Expectation::none()); |
@@ -611,8 +606,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
611 | self.unify(&expected_receiver_ty, &actual_receiver_ty); | 606 | self.unify(&expected_receiver_ty, &actual_receiver_ty); |
612 | 607 | ||
613 | self.check_call_arguments(args, ¶m_tys); | 608 | self.check_call_arguments(args, ¶m_tys); |
614 | let ret_ty = self.normalize_associated_types_in(ret_ty); | 609 | self.normalize_associated_types_in(ret_ty) |
615 | ret_ty | ||
616 | } | 610 | } |
617 | 611 | ||
618 | fn check_call_arguments(&mut self, args: &[ExprId], param_tys: &[Ty]) { | 612 | fn check_call_arguments(&mut self, args: &[ExprId], param_tys: &[Ty]) { |