Skip to content

Commit 3cb73da

Browse files
Rename to associated_type_shorthand_candidates
1 parent 8c26700 commit 3cb73da

File tree

3 files changed

+30
-29
lines changed

3 files changed

+30
-29
lines changed

crates/ra_hir/src/semantics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use hir_def::{
99
AsMacroCall, TraitId,
1010
};
1111
use hir_expand::ExpansionInfo;
12-
use hir_ty::associated_types;
12+
use hir_ty::associated_type_shorthand_candidates;
1313
use itertools::Itertools;
1414
use ra_db::{FileId, FileRange};
1515
use ra_prof::profile;
@@ -78,7 +78,7 @@ impl PathResolution {
7878
mut cb: impl FnMut(TypeAlias) -> Option<R>,
7979
) -> Option<R> {
8080
if let Some(res) = self.clone().in_type_ns() {
81-
associated_types(db, res, |_, _, id| cb(id.into()))
81+
associated_type_shorthand_candidates(db, res, |_, _, id| cb(id.into()))
8282
} else {
8383
None
8484
}

crates/ra_hir_ty/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ pub use autoderef::autoderef;
6666
pub use infer::{InferTy, InferenceResult};
6767
pub use lower::CallableDef;
6868
pub use lower::{
69-
associated_types, callable_item_sig, ImplTraitLoweringMode, TyDefId, TyLoweringContext,
70-
ValueTyDefId,
69+
associated_type_shorthand_candidates, callable_item_sig, ImplTraitLoweringMode, TyDefId,
70+
TyLoweringContext, ValueTyDefId,
7171
};
7272
pub use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment};
7373

crates/ra_hir_ty/src/lower.rs

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -385,31 +385,32 @@ impl Ty {
385385
segment: PathSegment<'_>,
386386
) -> Ty {
387387
if let Some(res) = res {
388-
let ty = associated_types(ctx.db, res, move |name, t, associated_ty| {
389-
if name == segment.name {
390-
let substs = match ctx.type_param_mode {
391-
TypeParamLoweringMode::Placeholder => {
392-
// if we're lowering to placeholders, we have to put
393-
// them in now
394-
let s = Substs::type_params(
395-
ctx.db,
396-
ctx.resolver
397-
.generic_def()
398-
.expect("there should be generics if there's a generic param"),
399-
);
400-
t.substs.clone().subst_bound_vars(&s)
401-
}
402-
TypeParamLoweringMode::Variable => t.substs.clone(),
403-
};
404-
// FIXME handle type parameters on the segment
405-
return Some(Ty::Projection(ProjectionTy {
406-
associated_ty,
407-
parameters: substs,
408-
}));
409-
}
388+
let ty =
389+
associated_type_shorthand_candidates(ctx.db, res, move |name, t, associated_ty| {
390+
if name == segment.name {
391+
let substs = match ctx.type_param_mode {
392+
TypeParamLoweringMode::Placeholder => {
393+
// if we're lowering to placeholders, we have to put
394+
// them in now
395+
let s = Substs::type_params(
396+
ctx.db,
397+
ctx.resolver.generic_def().expect(
398+
"there should be generics if there's a generic param",
399+
),
400+
);
401+
t.substs.clone().subst_bound_vars(&s)
402+
}
403+
TypeParamLoweringMode::Variable => t.substs.clone(),
404+
};
405+
// FIXME handle type parameters on the segment
406+
return Some(Ty::Projection(ProjectionTy {
407+
associated_ty,
408+
parameters: substs,
409+
}));
410+
}
410411

411-
None
412-
});
412+
None
413+
});
413414

414415
ty.unwrap_or(Ty::Unknown)
415416
} else {
@@ -671,7 +672,7 @@ pub fn callable_item_sig(db: &dyn HirDatabase, def: CallableDef) -> PolyFnSig {
671672
}
672673
}
673674

674-
pub fn associated_types<R>(
675+
pub fn associated_type_shorthand_candidates<R>(
675676
db: &dyn HirDatabase,
676677
res: TypeNs,
677678
mut cb: impl FnMut(&Name, &TraitRef, TypeAliasId) -> Option<R>,

0 commit comments

Comments
 (0)