set correct closure tag_id

This commit is contained in:
Folkert 2020-12-11 20:25:15 +01:00
parent 752a2200fd
commit 539f173472
3 changed files with 23 additions and 8 deletions

View file

@ -260,10 +260,17 @@ impl<'a> ClosureLayout<'a> {
Layout::Union(tags) => {
// NOTE it's very important that this Union consists of Closure tags
// and is not an unpacked 1-element record
let tag_id = self
.captured
.iter()
.position(|(tn, _)| *tn == TagName::Closure(original))
.unwrap() as _;
let expr = Expr::Tag {
tag_layout: Layout::Union(tags),
tag_name: TagName::Closure(original),
tag_id: 0,
tag_id,
union_size: tags.len() as u8,
arguments: symbols,
};