This commit is contained in:
Lukas Wirth 2023-02-27 15:51:45 +01:00
parent b38fcde3ba
commit 9e5fa74279
7 changed files with 44 additions and 52 deletions

View file

@ -3339,12 +3339,10 @@ impl Type {
.map(move |ty| self.derived(ty))
}
pub fn iterate_method_candidates<T>(
pub fn iterate_method_candidates_with_traits<T>(
&self,
db: &dyn HirDatabase,
scope: &SemanticsScope<'_>,
// FIXME this can be retrieved from `scope`, except autoimport uses this
// to specify a different set, so the method needs to be split
traits_in_scope: &FxHashSet<TraitId>,
with_local_impls: Option<Module>,
name: Option<&Name>,
@ -3372,6 +3370,24 @@ impl Type {
slot
}
pub fn iterate_method_candidates<T>(
&self,
db: &dyn HirDatabase,
scope: &SemanticsScope<'_>,
with_local_impls: Option<Module>,
name: Option<&Name>,
mut callback: impl FnMut(Function) -> Option<T>,
) -> Option<T> {
self.iterate_method_candidates_with_traits(
db,
scope,
&scope.visible_traits().0,
with_local_impls,
name,
callback,
)
}
fn iterate_method_candidates_dyn(
&self,
db: &dyn HirDatabase,