fix recursion layout issue

This commit is contained in:
Folkert 2021-05-24 14:15:52 +02:00
parent 1aa71113ca
commit 06bf614437
4 changed files with 25 additions and 4 deletions

View file

@ -423,6 +423,12 @@ impl<'a, 'b> Env<'a, 'b> {
self.seen.insert(var)
}
fn remove_seen(&mut self, var: Variable) -> bool {
let var = self.subs.get_root_key_without_compacting(var);
self.seen.remove(&var)
}
}
impl<'a> Layout<'a> {
@ -1248,6 +1254,8 @@ fn layout_from_flat_type<'a>(
UnionLayout::Recursive(tag_layouts.into_bump_slice())
};
env.remove_seen(rec_var);
Ok(Layout::Union(union_layout))
}
EmptyTagUnion => {