From e50201345ecc91b9eeb284cd04c6b55f9c5ce0fd Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 21 Feb 2020 13:47:49 +0100 Subject: Normalize associated types in types coming from Chalk Fixes #3232. --- crates/ra_hir_ty/src/infer/unify.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_ty/src/infer') diff --git a/crates/ra_hir_ty/src/infer/unify.rs b/crates/ra_hir_ty/src/infer/unify.rs index 9c7996572..2d03c5c33 100644 --- a/crates/ra_hir_ty/src/infer/unify.rs +++ b/crates/ra_hir_ty/src/infer/unify.rs @@ -161,7 +161,10 @@ impl Canonicalized { let new_vars = Substs((0..solution.num_vars).map(|_| ctx.table.new_type_var()).collect()); for (i, ty) in solution.value.into_iter().enumerate() { let var = self.free_vars[i]; - ctx.table.unify(&Ty::Infer(var), &ty.subst_bound_vars(&new_vars)); + // eagerly replace projections in the type; we may be getting types + // e.g. from where clauses where this hasn't happened yet + let ty = ctx.normalize_associated_types_in(ty.subst_bound_vars(&new_vars)); + ctx.table.unify(&Ty::Infer(var), &ty); } } } -- cgit v1.2.3