aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer/expr.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-21 12:50:12 +0000
committerGitHub <[email protected]>2019-11-21 12:50:12 +0000
commit1f61915bde4c5d8d4fe2e9b8dfa9445008730b79 (patch)
treea6fd0b6ad8b6c87d28e6e1b36bb9b2fbae2c1b09 /crates/ra_hir/src/ty/infer/expr.rs
parent612a72fc4ea4376920f2a7da7b3c334227c1716c (diff)
parentc37d1c5b381365ce2d07dfe4b871e43995ccea2d (diff)
Merge #2337
2337: Move resolver to hir_def r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/ty/infer/expr.rs')
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index 5e68a1678..ac570075f 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -6,13 +6,13 @@ use std::sync::Arc;
6use hir_def::{ 6use hir_def::{
7 builtin_type::Signedness, 7 builtin_type::Signedness,
8 path::{GenericArg, GenericArgs}, 8 path::{GenericArg, GenericArgs},
9 resolver::resolver_for_expr,
9}; 10};
10use hir_expand::name; 11use hir_expand::name;
11 12
12use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch};
13use crate::{ 13use crate::{
14 db::HirDatabase, 14 db::HirDatabase,
15 expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, 15 expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
16 generics::{GenericParams, HasGenericParams}, 16 generics::{GenericParams, HasGenericParams},
17 ty::{ 17 ty::{
18 autoderef, method_resolution, op, CallableDef, InferTy, IntTy, Mutability, Namespace, 18 autoderef, method_resolution, op, CallableDef, InferTy, IntTy, Mutability, Namespace,
@@ -22,6 +22,8 @@ use crate::{
22 Adt, Name, 22 Adt, Name,
23}; 23};
24 24
25use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch};
26
25impl<'a, D: HirDatabase> InferenceContext<'a, D> { 27impl<'a, D: HirDatabase> InferenceContext<'a, D> {
26 pub(super) fn infer_expr(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty { 28 pub(super) fn infer_expr(&mut self, tgt_expr: ExprId, expected: &Expectation) -> Ty {
27 let ty = self.infer_expr_inner(tgt_expr, expected); 29 let ty = self.infer_expr_inner(tgt_expr, expected);
@@ -186,7 +188,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
186 } 188 }
187 Expr::Path(p) => { 189 Expr::Path(p) => {
188 // FIXME this could be more efficient... 190 // FIXME this could be more efficient...
189 let resolver = expr::resolver_for_expr(self.db, self.owner, tgt_expr); 191 let resolver = resolver_for_expr(self.db, self.owner.into(), tgt_expr);
190 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) 192 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown)
191 } 193 }
192 Expr::Continue => Ty::simple(TypeCtor::Never), 194 Expr::Continue => Ty::simple(TypeCtor::Never),