From 0f7f1f070584fbdc07a10df47b95b147698551fd Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 2 May 2021 16:32:42 +0200 Subject: Temporary fix for unknown expectations --- crates/hir_ty/src/infer.rs | 4 ++++ crates/hir_ty/src/infer/coerce.rs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'crates/hir_ty') diff --git a/crates/hir_ty/src/infer.rs b/crates/hir_ty/src/infer.rs index 603068ab5..f3cccca68 100644 --- a/crates/hir_ty/src/infer.rs +++ b/crates/hir_ty/src/infer.rs @@ -395,6 +395,10 @@ impl<'a> InferenceContext<'a> { } fn unify(&mut self, ty1: &Ty, ty2: &Ty) -> bool { + // TODO handle expectations properly + if ty2.is_unknown() { + return true; + } self.table.unify(ty1, ty2) } diff --git a/crates/hir_ty/src/infer/coerce.rs b/crates/hir_ty/src/infer/coerce.rs index c82bda70f..8467ea056 100644 --- a/crates/hir_ty/src/infer/coerce.rs +++ b/crates/hir_ty/src/infer/coerce.rs @@ -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) { -- cgit v1.2.3