Temporary fix for unknown expectations

This commit is contained in:
Florian Diebold 2021-05-02 16:32:42 +02:00
parent 4ca1981c91
commit 0f7f1f0705
2 changed files with 8 additions and 0 deletions

View File

@ -395,6 +395,10 @@ fn push_obligation(&mut self, o: DomainGoal) {
}
fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool {
// TODO handle expectations properly
if ty2.is_unknown() {
return true;
}
self.table.unify(ty1, ty2)
}

View File

@ -19,6 +19,10 @@ impl<'a> InferenceContext<'a> {
/// Unify two types, but may coerce the first one to the second one
/// using "implicit coercion rules" if needed.
pub(super) fn coerce(&mut self, from_ty: &Ty, to_ty: &Ty) -> bool {
// TODO handle expectations properly
if to_ty.is_unknown() {
return true;
}
let from_ty = self.resolve_ty_shallow(from_ty).into_owned();
let to_ty = self.resolve_ty_shallow(to_ty);
match self.coerce_inner(from_ty, &to_ty) {