From 21c5fd8b1b8f9536449325738baea1e48efdefe0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 14 Jan 2020 14:20:33 +0100 Subject: Push resolver further up --- crates/ra_hir/src/source_analyzer.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs index 3df48842d..5707a5696 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/ra_hir/src/source_analyzer.rs @@ -358,10 +358,17 @@ impl SourceAnalyzer { // FIXME check that? // FIXME replace Unknown by bound vars here let canonical = Canonical { value: ty.ty.value.clone(), num_vars: 0 }; + + let env = TraitEnvironment::lower(db, &self.resolver); + let krate = self.resolver.krate()?; + let traits_in_scope = self.resolver.traits_in_scope(db); + method_resolution::iterate_method_candidates( &canonical, db, - &self.resolver, + env, + krate, + &traits_in_scope, name, method_resolution::LookupMode::MethodCall, |ty, it| match it { @@ -382,10 +389,17 @@ impl SourceAnalyzer { // FIXME check that? // FIXME replace Unknown by bound vars here let canonical = Canonical { value: ty.ty.value.clone(), num_vars: 0 }; + + let env = TraitEnvironment::lower(db, &self.resolver); + let krate = self.resolver.krate()?; + let traits_in_scope = self.resolver.traits_in_scope(db); + method_resolution::iterate_method_candidates( &canonical, db, - &self.resolver, + env, + krate, + &traits_in_scope, name, method_resolution::LookupMode::Path, |ty, it| callback(ty, it.into()), -- cgit v1.2.3