Correctly compile unified recursive tag unions

This commit is contained in:
Ayaz Hafiz 2022-07-08 17:31:41 -04:00
parent 8c5f798f4e
commit 808d19b01b
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
7 changed files with 84 additions and 14 deletions

View file

@ -2317,6 +2317,8 @@ fn from_can_let<'a>(
let (_specialization_mark, (var, specialized_symbol)) =
needed_specializations.next().unwrap();
// Make sure rigid variables in the annotation are converted to flex variables.
instantiate_rigids(env.subs, def.expr_var);
// Unify the expr_var with the requested specialization once.
let _res = env.unify(var, def.expr_var);
@ -2333,6 +2335,9 @@ fn from_can_let<'a>(
_n => {
let mut stmt = rest;
// Make sure rigid variables in the annotation are converted to flex variables.
instantiate_rigids(env.subs, def.expr_var);
// Need to eat the cost and create a specialized version of the body for
// each specialization.
for (_specialization_mark, (var, specialized_symbol)) in