From 6da22ed9752b239fcd4e7c75673907ceb1ac6b65 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 16 Jul 2020 18:24:26 +0200 Subject: Redner self as param for call infor for assoc fn call --- crates/ra_hir/src/code_model.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 057dfb82a..eb6a14eda 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -1552,7 +1552,10 @@ impl Callable { let param_list = src.value.param_list()?; param_list.self_param() } - pub fn params(&self, db: &dyn HirDatabase) -> Vec<(Option, Type)> { + pub fn params( + &self, + db: &dyn HirDatabase, + ) -> Vec<(Option>, Type)> { let types = self .sig .params() @@ -1562,7 +1565,14 @@ impl Callable { let patterns = match self.id { CallableDefId::FunctionId(func) => { let src = func.lookup(db.upcast()).source(db.upcast()); - src.value.param_list().map(|it| it.params().map(|it| it.pat())) + src.value.param_list().map(|param_list| { + param_list + .self_param() + .map(|it| Some(Either::Left(it))) + .filter(|_| !self.is_bound_method) + .into_iter() + .chain(param_list.params().map(|it| it.pat().map(Either::Right))) + }) } CallableDefId::StructId(_) => None, CallableDefId::EnumVariantId(_) => None, -- cgit v1.2.3