Complete assoc. items on type parameters

This commit is contained in:
Jonas Schievink 2020-04-28 00:40:32 +02:00
parent 4ff3573e18
commit 8c2670026a
5 changed files with 408 additions and 69 deletions

View file

@ -953,6 +953,16 @@ impl TypeParam {
pub fn module(self, db: &dyn HirDatabase) -> Module {
self.id.parent.module(db.upcast()).into()
}
pub fn ty(self, db: &dyn HirDatabase) -> Type {
let resolver = self.id.parent.resolver(db.upcast());
let environment = TraitEnvironment::lower(db, &resolver);
let ty = Ty::Placeholder(self.id);
Type {
krate: self.id.parent.module(db.upcast()).krate,
ty: InEnvironment { value: ty, environment },
}
}
}
// FIXME: rename from `ImplDef` to `Impl`