mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Add method resolution deref inference var test
This commit is contained in:
parent
d21f88883b
commit
c679482d7e
3 changed files with 30 additions and 16 deletions
|
@ -312,15 +312,13 @@ impl InferenceContext<'_> {
|
|||
Expr::Call { callee, args, .. } => {
|
||||
let callee_ty = self.infer_expr(*callee, &Expectation::none());
|
||||
let mut derefs = Autoderef::new(&mut self.table, callee_ty.clone(), false);
|
||||
let (res, derefed_callee) = 'b: {
|
||||
// manual loop to be able to access `derefs.table`
|
||||
while let Some((callee_deref_ty, _)) = derefs.next() {
|
||||
let res = derefs.table.callable_sig(&callee_deref_ty, args.len());
|
||||
if res.is_some() {
|
||||
break 'b (res, callee_deref_ty);
|
||||
}
|
||||
let (res, derefed_callee) = loop {
|
||||
let Some((callee_deref_ty, _)) = derefs.next() else {
|
||||
break (None, callee_ty.clone());
|
||||
};
|
||||
if let Some(res) = derefs.table.callable_sig(&callee_deref_ty, args.len()) {
|
||||
break (Some(res), callee_deref_ty);
|
||||
}
|
||||
(None, callee_ty.clone())
|
||||
};
|
||||
// if the function is unresolved, we use is_varargs=true to
|
||||
// suppress the arg count diagnostic here
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue