Fix HIR expecting errors to unify with anything

This commit is contained in:
Florian Diebold 2021-05-15 20:28:07 +02:00
parent 48c492af7e
commit 8397734cfe
3 changed files with 65 additions and 8 deletions

View file

@ -2051,11 +2051,7 @@ impl Type {
name: Option<&Name>,
mut callback: impl FnMut(&Ty, AssocItem) -> Option<T>,
) -> Option<T> {
// There should be no inference vars in types passed here
// FIXME check that?
// FIXME replace Unknown by bound vars here
let canonical =
Canonical { value: self.ty.clone(), binders: CanonicalVarKinds::empty(&Interner) };
let canonical = hir_ty::replace_errors_with_variables(self.ty.clone());
let env = self.env.clone();
let krate = krate.id;
@ -2224,7 +2220,8 @@ impl Type {
}
pub fn could_unify_with(&self, db: &dyn HirDatabase, other: &Type) -> bool {
could_unify(db, self.env.clone(), &self.ty, &other.ty)
let tys = hir_ty::replace_errors_with_variables((self.ty.clone(), other.ty.clone()));
could_unify(db, self.env.clone(), &tys)
}
}