Skip to content

Commit

Permalink
Improve error recovery when method-calling a field
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Feb 12, 2025
1 parent 8aa4ae5 commit 22fa5a7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/hir-ty/src/infer/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1939,14 +1939,11 @@ impl InferenceContext<'_> {
expr: tgt_expr,
receiver: receiver_ty.clone(),
name: method_name.clone(),
field_with_same_name: field_with_same_name_exists,
field_with_same_name: field_with_same_name_exists.clone(),
assoc_func_with_same_name,
});
(
receiver_ty,
Binders::empty(Interner, self.err_ty()),
Substitution::empty(Interner),
)
self.check_call_arguments(tgt_expr, args, &[], &[], &[], true);
return field_with_same_name_exists.unwrap_or_else(|| self.err_ty());
}
};
self.check_method_call(tgt_expr, args, method_ty, substs, receiver_ty, expected)
Expand Down

0 comments on commit 22fa5a7

Please sign in to comment.