Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/infer.rs')
-rw-r--r--crates/hir-ty/src/infer.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index a09dcaafbb..045b85b7bc 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -44,7 +44,7 @@ use hir_def::{
FunctionId, GenericDefId, GenericParamId, HasModule, LocalFieldId, Lookup, StaticId, TraitId,
TupleFieldId, TupleId, VariantId,
attrs::AttrFlags,
- expr_store::{Body, ExpressionStore, HygieneId, path::Path},
+ expr_store::{Body, ExpressionStore, HygieneId, body::Param, path::Path},
hir::{BindingId, ExprId, ExprOrPatId, LabelId, PatId},
lang_item::LangItems,
layout::Integer,
@@ -145,7 +145,9 @@ pub fn infer_query_with_inspect<'db>(
}
match def {
- DefWithBodyId::FunctionId(f) => ctx.collect_fn(f, body.self_param(), &body.params),
+ DefWithBodyId::FunctionId(f) => {
+ ctx.collect_fn(f, body.self_param.map(|param| param.formal), &body.params)
+ }
DefWithBodyId::ConstId(c) => ctx.collect_const(c, ConstSignature::of(db, c)),
DefWithBodyId::StaticId(s) => ctx.collect_static(s, StaticSignature::of(db, s)),
DefWithBodyId::VariantId(v) => {
@@ -1695,7 +1697,12 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
self.return_ty = return_ty;
}
- fn collect_fn(&mut self, func: FunctionId, self_param: Option<BindingId>, params: &[PatId]) {
+ fn collect_fn(
+ &mut self,
+ func: FunctionId,
+ self_param: Option<BindingId>,
+ params: &[Param<PatId>],
+ ) {
let data = FunctionSignature::of(self.db, func);
let mut param_tys = self.with_ty_lowering(
&data.store,
@@ -1734,7 +1741,7 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
let ty = param_tys.next().unwrap_or_else(|| self.table.next_ty_var(Span::Dummy));
let ty = self.process_user_written_ty(ty);
- self.infer_top_pat(*pat, ty, PatOrigin::Param);
+ self.infer_top_pat(pat.formal, ty, PatOrigin::Param);
}
self.return_ty = match data.ret_type {
Some(return_ty) => {