aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/infer
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/infer')
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs2
-rw-r--r--crates/ra_hir/src/ty/infer/path.rs23
2 files changed, 13 insertions, 12 deletions
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index 414b06ba1..1ac2709f5 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -187,7 +187,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
187 } 187 }
188 Expr::Path(p) => { 188 Expr::Path(p) => {
189 // FIXME this could be more efficient... 189 // FIXME this could be more efficient...
190 let resolver = resolver_for_expr(self.db, self.owner, tgt_expr); 190 let resolver = resolver_for_expr(self.db, self.owner.into(), tgt_expr);
191 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown) 191 self.infer_path(&resolver, p, tgt_expr.into()).unwrap_or(Ty::Unknown)
192 } 192 }
193 Expr::Continue => Ty::simple(TypeCtor::Never), 193 Expr::Continue => Ty::simple(TypeCtor::Never),
diff --git a/crates/ra_hir/src/ty/infer/path.rs b/crates/ra_hir/src/ty/infer/path.rs
index f36a27929..55a5dbec7 100644
--- a/crates/ra_hir/src/ty/infer/path.rs
+++ b/crates/ra_hir/src/ty/infer/path.rs
@@ -8,7 +8,7 @@ use crate::{
8 generics::HasGenericParams, 8 generics::HasGenericParams,
9 resolve::{ResolveValueResult, Resolver, TypeNs, ValueNs}, 9 resolve::{ResolveValueResult, Resolver, TypeNs, ValueNs},
10 ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk}, 10 ty::{method_resolution, Namespace, Substs, Ty, TypableDef, TypeWalk},
11 AssocItem, Container, Name, Path, 11 AssocItem, Container, Function, Name, Path,
12}; 12};
13 13
14impl<'a, D: HirDatabase> InferenceContext<'a, D> { 14impl<'a, D: HirDatabase> InferenceContext<'a, D> {
@@ -60,11 +60,11 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
60 let ty = self.resolve_ty_as_possible(&mut vec![], ty); 60 let ty = self.resolve_ty_as_possible(&mut vec![], ty);
61 return Some(ty); 61 return Some(ty);
62 } 62 }
63 ValueNs::Function(it) => it.into(), 63 ValueNs::FunctionId(it) => it.into(),
64 ValueNs::Const(it) => it.into(), 64 ValueNs::ConstId(it) => it.into(),
65 ValueNs::Static(it) => it.into(), 65 ValueNs::StaticId(it) => it.into(),
66 ValueNs::Struct(it) => it.into(), 66 ValueNs::StructId(it) => it.into(),
67 ValueNs::EnumVariant(it) => it.into(), 67 ValueNs::EnumVariantId(it) => it.into(),
68 }; 68 };
69 69
70 let mut ty = self.db.type_for_def(typable, Namespace::Values); 70 let mut ty = self.db.type_for_def(typable, Namespace::Values);
@@ -160,8 +160,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
160 AssocItem::TypeAlias(_) => None, 160 AssocItem::TypeAlias(_) => None,
161 })?; 161 })?;
162 let def = match item { 162 let def = match item {
163 AssocItem::Function(f) => ValueNs::Function(f), 163 AssocItem::Function(f) => ValueNs::FunctionId(f.id),
164 AssocItem::Const(c) => ValueNs::Const(c), 164 AssocItem::Const(c) => ValueNs::ConstId(c.id),
165 AssocItem::TypeAlias(_) => unreachable!(), 165 AssocItem::TypeAlias(_) => unreachable!(),
166 }; 166 };
167 let substs = Substs::build_for_def(self.db, item) 167 let substs = Substs::build_for_def(self.db, item)
@@ -193,8 +193,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
193 method_resolution::LookupMode::Path, 193 method_resolution::LookupMode::Path,
194 move |_ty, item| { 194 move |_ty, item| {
195 let def = match item { 195 let def = match item {
196 AssocItem::Function(f) => ValueNs::Function(f), 196 AssocItem::Function(f) => ValueNs::FunctionId(f.id),
197 AssocItem::Const(c) => ValueNs::Const(c), 197 AssocItem::Const(c) => ValueNs::ConstId(c.id),
198 AssocItem::TypeAlias(_) => unreachable!(), 198 AssocItem::TypeAlias(_) => unreachable!(),
199 }; 199 };
200 let substs = match item.container(self.db) { 200 let substs = match item.container(self.db) {
@@ -224,7 +224,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
224 } 224 }
225 225
226 fn find_self_types(&self, def: &ValueNs, actual_def_ty: Ty) -> Option<Substs> { 226 fn find_self_types(&self, def: &ValueNs, actual_def_ty: Ty) -> Option<Substs> {
227 if let ValueNs::Function(func) = def { 227 if let ValueNs::FunctionId(func) = def {
228 let func = Function::from(*func);
228 // We only do the infer if parent has generic params 229 // We only do the infer if parent has generic params
229 let gen = func.generic_params(self.db); 230 let gen = func.generic_params(self.db);
230 if gen.count_parent_params() == 0 { 231 if gen.count_parent_params() == 0 {