fix: prefer keeping Self if it is in the same impl def

This commit is contained in:
Ryan Mehri 2023-10-09 08:30:34 -07:00 committed by Lukas Wirth
parent f4349ff26e
commit 7e768cbe70
4 changed files with 28 additions and 11 deletions

View file

@ -1556,6 +1556,10 @@ impl SemanticsScope<'_> {
pub fn extern_crate_decls(&self) -> impl Iterator<Item = Name> + '_ {
self.resolver.extern_crate_decls_in_scope(self.db.upcast())
}
pub fn has_same_self_type(&self, other: &SemanticsScope<'_>) -> bool {
self.resolver.impl_def() == other.resolver.impl_def()
}
}
#[derive(Debug)]