Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_ty/src/infer/unify.rs')
| -rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 9f1253825e..4c1e758904 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs @@ -41,8 +41,13 @@ where } impl<T: HasInterner<Interner = Interner>> Canonicalized<T> { - pub(super) fn decanonicalize_ty(&self, ty: Ty) -> Ty { - chalk_ir::Substitute::apply(&self.free_vars, ty, &Interner) + /// this method is wrong and shouldn't exist + pub(super) fn decanonicalize_ty(&self, table: &mut InferenceTable, ty: Canonical<Ty>) -> Ty { + let mut vars = self.free_vars.clone(); + while ty.binders.len(&Interner) > vars.len() { + vars.push(table.new_type_var().cast(&Interner)); + } + chalk_ir::Substitute::apply(&vars, ty.value, &Interner) } pub(super) fn apply_solution( |