diff options
Diffstat (limited to 'crates/ra_hir/src/ty/infer.rs')
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 921130b71..f5f85308c 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -393,17 +393,22 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
393 | // Attempt to find an impl_item for the type which has a name matching | 393 | // Attempt to find an impl_item for the type which has a name matching |
394 | // the current segment | 394 | // the current segment |
395 | log::debug!("looking for path segment: {:?}", segment); | 395 | log::debug!("looking for path segment: {:?}", segment); |
396 | let item = ty.iterate_impl_items(self.db, |item| match item { | 396 | let item: crate::ModuleDef = ty.iterate_impl_items(self.db, |item| match item { |
397 | crate::ImplItem::Method(func) => { | 397 | crate::ImplItem::Method(func) => { |
398 | let sig = func.signature(self.db); | 398 | let sig = func.signature(self.db); |
399 | if segment.name == *sig.name() { | 399 | if segment.name == *sig.name() { |
400 | return Some(func); | 400 | return Some(func.into()); |
401 | } | 401 | } |
402 | None | 402 | None |
403 | } | 403 | } |
404 | 404 | ||
405 | // TODO: Resolve associated const | 405 | crate::ImplItem::Const(konst) => { |
406 | crate::ImplItem::Const(_) => None, | 406 | let sig = konst.signature(self.db); |
407 | if segment.name == *sig.name() { | ||
408 | return Some(konst.into()); | ||
409 | } | ||
410 | None | ||
411 | } | ||
407 | 412 | ||
408 | // TODO: Resolve associated types | 413 | // TODO: Resolve associated types |
409 | crate::ImplItem::TypeAlias(_) => None, | 414 | crate::ImplItem::TypeAlias(_) => None, |
@@ -477,9 +482,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
477 | let ty = self.insert_type_vars(ty.apply_substs(substs)); | 482 | let ty = self.insert_type_vars(ty.apply_substs(substs)); |
478 | (ty, Some(var.into())) | 483 | (ty, Some(var.into())) |
479 | } | 484 | } |
480 | TypableDef::TypeAlias(_) | TypableDef::Function(_) | TypableDef::Enum(_) => { | 485 | TypableDef::TypeAlias(_) |
481 | (Ty::Unknown, None) | 486 | | TypableDef::Function(_) |
482 | } | 487 | | TypableDef::Enum(_) |
488 | | TypableDef::Const(_) => (Ty::Unknown, None), | ||
483 | } | 489 | } |
484 | } | 490 | } |
485 | 491 | ||