Fix crash with int vars in canonicalization

This commit is contained in:
Florian Diebold
2019-05-20 18:31:41 +02:00
parent f613c48d2e
commit ced971ee9f
+6 -1
View File
@@ -56,7 +56,12 @@ fn do_canonicalize_ty(&mut self, ty: Ty) -> Ty {
self.var_stack.pop();
result
} else {
let free_var = InferTy::TypeVar(self.ctx.var_unification_table.find(inner));
let root = self.ctx.var_unification_table.find(inner);
let free_var = match tv {
InferTy::TypeVar(_) => InferTy::TypeVar(root),
InferTy::IntVar(_) => InferTy::IntVar(root),
InferTy::FloatVar(_) => InferTy::FloatVar(root),
};
let position = self.add(free_var);
Ty::Bound(position as u32)
}