Rename target_ty to self_ty

This commit is contained in:
Lukas Wirth 2021-03-29 17:46:33 +02:00
parent bb6e1bf811
commit c2a63b97a8
16 changed files with 27 additions and 27 deletions

View file

@ -1574,9 +1574,9 @@ impl Impl {
};
let filter = |impl_def: &Impl| {
let target_ty = impl_def.target_ty(db);
let rref = target_ty.remove_ref();
ty.equals_ctor(rref.as_ref().map_or(&target_ty.ty, |it| &it.ty))
let self_ty = impl_def.self_ty(db);
let rref = self_ty.remove_ref();
ty.equals_ctor(rref.as_ref().map_or(&self_ty.ty, |it| &it.ty))
};
let mut all = Vec::new();
@ -1614,16 +1614,16 @@ impl Impl {
// FIXME: the return type is wrong. This should be a hir version of
// `TraitRef` (ie, resolved `TypeRef`).
pub fn target_trait(self, db: &dyn HirDatabase) -> Option<TraitRef> {
pub fn trait_(self, db: &dyn HirDatabase) -> Option<TraitRef> {
db.impl_data(self.id).target_trait.clone()
}
pub fn target_ty(self, db: &dyn HirDatabase) -> Type {
pub fn self_ty(self, db: &dyn HirDatabase) -> Type {
let impl_data = db.impl_data(self.id);
let resolver = self.id.resolver(db.upcast());
let krate = self.id.lookup(db.upcast()).container.krate();
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
let ty = ctx.lower_ty(&impl_data.target_type);
let ty = ctx.lower_ty(&impl_data.self_ty);
Type::new_with_resolver_inner(db, krate, &resolver, ty)
}