AsMacroCall, FunctionId, TraitId, VariantId,
};
use hir_expand::{name::AsName, ExpansionInfo};
-use hir_ty::associated_type_shorthand_candidates;
+use hir_ty::{associated_type_shorthand_candidates, Interner};
use itertools::Itertools;
use rustc_hash::{FxHashMap, FxHashSet};
use syntax::{
}
fn resolve_method_call(&self, call: &ast::MethodCallExpr) -> Option<FunctionId> {
- self.analyze(call.syntax()).resolve_method_call(self.db, call)
+ self.analyze(call.syntax()).resolve_method_call(self.db, call).map(|(id, _)| id)
}
fn resolve_method_call_as_callable(&self, call: &ast::MethodCallExpr) -> Option<Callable> {
- // FIXME: this erases Substs, we should instead record the correct
- // substitution during inference and use that
- let func = self.resolve_method_call(call)?;
- let ty = hir_ty::TyBuilder::value_ty(self.db, func.into()).fill_with_unknown().build();
+ let (func, subst) = self.analyze(call.syntax()).resolve_method_call(self.db, call)?;
+ let ty = self.db.value_ty(func.into()).substitute(&Interner, &subst);
let resolver = self.analyze(call.syntax()).resolver;
let ty = Type::new_with_resolver(self.db, &resolver, ty)?;
let mut res = ty.as_callable(self.db)?;