diff options
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 1ee40c70a..2c05ca734 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -27,7 +27,7 @@ use ra_prof::profile; | |||
27 | use test_utils::tested_by; | 27 | use test_utils::tested_by; |
28 | 28 | ||
29 | use crate::{ | 29 | use crate::{ |
30 | Function, StructField, Path, Name, FnSignature, AdtDef, ConstSignature, HirDatabase, | 30 | Function, StructField, Path, Name, FnData, AdtDef, ConstData, HirDatabase, |
31 | DefWithBody, ImplItem, | 31 | DefWithBody, ImplItem, |
32 | type_ref::{TypeRef, Mutability}, | 32 | type_ref::{TypeRef, Mutability}, |
33 | expr::{ | 33 | expr::{ |
@@ -59,9 +59,9 @@ pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResu | |||
59 | let mut ctx = InferenceContext::new(db, body, resolver); | 59 | let mut ctx = InferenceContext::new(db, body, resolver); |
60 | 60 | ||
61 | match def { | 61 | match def { |
62 | DefWithBody::Const(ref c) => ctx.collect_const_signature(&c.signature(db)), | 62 | DefWithBody::Const(ref c) => ctx.collect_const(&c.data(db)), |
63 | DefWithBody::Function(ref f) => ctx.collect_fn_signature(&f.signature(db)), | 63 | DefWithBody::Function(ref f) => ctx.collect_fn(&f.data(db)), |
64 | DefWithBody::Static(ref s) => ctx.collect_const_signature(&s.signature(db)), | 64 | DefWithBody::Static(ref s) => ctx.collect_const(&s.data(db)), |
65 | } | 65 | } |
66 | 66 | ||
67 | ctx.infer_body(); | 67 | ctx.infer_body(); |
@@ -509,8 +509,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
509 | let item: crate::ModuleDef = ty.iterate_impl_items(self.db, krate, |item| { | 509 | let item: crate::ModuleDef = ty.iterate_impl_items(self.db, krate, |item| { |
510 | let matching_def: Option<crate::ModuleDef> = match item { | 510 | let matching_def: Option<crate::ModuleDef> = match item { |
511 | crate::ImplItem::Method(func) => { | 511 | crate::ImplItem::Method(func) => { |
512 | let sig = func.signature(self.db); | 512 | if segment.name == func.name(self.db) { |
513 | if segment.name == *sig.name() { | ||
514 | Some(func.into()) | 513 | Some(func.into()) |
515 | } else { | 514 | } else { |
516 | None | 515 | None |
@@ -518,8 +517,8 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
518 | } | 517 | } |
519 | 518 | ||
520 | crate::ImplItem::Const(konst) => { | 519 | crate::ImplItem::Const(konst) => { |
521 | let sig = konst.signature(self.db); | 520 | let data = konst.data(self.db); |
522 | if segment.name == *sig.name() { | 521 | if segment.name == *data.name() { |
523 | Some(konst.into()) | 522 | Some(konst.into()) |
524 | } else { | 523 | } else { |
525 | None | 524 | None |
@@ -1283,18 +1282,18 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
1283 | ty | 1282 | ty |
1284 | } | 1283 | } |
1285 | 1284 | ||
1286 | fn collect_const_signature(&mut self, signature: &ConstSignature) { | 1285 | fn collect_const(&mut self, data: &ConstData) { |
1287 | self.return_ty = self.make_ty(signature.type_ref()); | 1286 | self.return_ty = self.make_ty(data.type_ref()); |
1288 | } | 1287 | } |
1289 | 1288 | ||
1290 | fn collect_fn_signature(&mut self, signature: &FnSignature) { | 1289 | fn collect_fn(&mut self, data: &FnData) { |
1291 | let body = Arc::clone(&self.body); // avoid borrow checker problem | 1290 | let body = Arc::clone(&self.body); // avoid borrow checker problem |
1292 | for (type_ref, pat) in signature.params().iter().zip(body.params()) { | 1291 | for (type_ref, pat) in data.params().iter().zip(body.params()) { |
1293 | let ty = self.make_ty(type_ref); | 1292 | let ty = self.make_ty(type_ref); |
1294 | 1293 | ||
1295 | self.infer_pat(*pat, &ty, BindingMode::default()); | 1294 | self.infer_pat(*pat, &ty, BindingMode::default()); |
1296 | } | 1295 | } |
1297 | self.return_ty = self.make_ty(signature.ret_type()); | 1296 | self.return_ty = self.make_ty(data.ret_type()); |
1298 | } | 1297 | } |
1299 | 1298 | ||
1300 | fn infer_body(&mut self) { | 1299 | fn infer_body(&mut self) { |