Correctly fill default type parameters

This commit is contained in:
Fedor Sakharov 2020-05-13 16:06:42 +03:00
parent 88d3959c33
commit 00f3b6c59a
No known key found for this signature in database
GPG key ID: 93D436E666BF0FEE
6 changed files with 80 additions and 1 deletions

View file

@ -989,6 +989,11 @@ impl TypeParam {
ty: InEnvironment { value: ty, environment },
}
}
pub fn default(self, db: &dyn HirDatabase) -> Option<TypeRef> {
let params = db.generic_params(self.id.parent);
params.types[self.id.local_id].default.clone()
}
}
// FIXME: rename from `ImplDef` to `Impl`