diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index f182ab228fe..afbf78b3b83 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -708,7 +708,7 @@ impl Function { Some(SelfParam { func: self.id }) } - pub fn params(self, db: &dyn HirDatabase) -> Vec { + pub fn params(self, db: &dyn HirDatabase) -> Vec { let resolver = self.id.resolver(db.upcast()); let ctx = hir_ty::TyLoweringContext::new(db, &resolver); let environment = TraitEnvironment::lower(db, &resolver); @@ -724,7 +724,7 @@ impl Function { environment: environment.clone(), }, }; - ty + Param { ty } }) .collect() } @@ -754,6 +754,16 @@ impl From for Access { } } +pub struct Param { + ty: Type, +} + +impl Param { + pub fn ty(&self) -> &Type { + &self.ty + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct SelfParam { func: FunctionId, diff --git a/crates/ide/src/completion/presentation.rs b/crates/ide/src/completion/presentation.rs index cfcb6dfa190..0c29d0be246 100644 --- a/crates/ide/src/completion/presentation.rs +++ b/crates/ide/src/completion/presentation.rs @@ -231,7 +231,7 @@ impl Completions { if let Some(pat) = it.pat() { let name = pat.to_string(); let arg = name.trim_start_matches('_'); - return Some(add_arg(arg, ¶m_ty, ctx)); + return Some(add_arg(arg, param_ty.ty(), ctx)); } None })