Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/source_analyzer.rs')
-rw-r--r--crates/hir/src/source_analyzer.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs
index 869f4a10f8..03e4420985 100644
--- a/crates/hir/src/source_analyzer.rs
+++ b/crates/hir/src/source_analyzer.rs
@@ -619,9 +619,15 @@ fn resolve_hir_path_(
TypeNs::TraitId(it) => PathResolution::Def(Trait::from(it).into()),
};
match unresolved {
- Some(unresolved) => res
- .assoc_type_shorthand_candidates(db, |name, alias| {
- (name == unresolved.name).then(|| alias)
+ Some(unresolved) => resolver
+ .generic_def()
+ .and_then(|def| {
+ hir_ty::associated_type_shorthand_candidates(
+ db,
+ def,
+ res.in_type_ns()?,
+ |name, _, id| (name == unresolved.name).then(|| id),
+ )
})
.map(TypeAlias::from)
.map(Into::into)