mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
fix recursive layout issue
This commit is contained in:
parent
66a6080f25
commit
3a97ccd8ac
4 changed files with 8 additions and 10 deletions
|
@ -1113,7 +1113,6 @@ fn layout_from_flat_type<'a>(
|
|||
// That means none of the optimizations for enums or single tag tag unions apply
|
||||
|
||||
let rec_var = subs.get_root_key_without_compacting(rec_var);
|
||||
env.insert_seen(rec_var);
|
||||
let mut tag_layouts = Vec::with_capacity_in(tags.len(), arena);
|
||||
|
||||
// VERY IMPORTANT: sort the tags
|
||||
|
@ -1131,6 +1130,7 @@ fn layout_from_flat_type<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
env.insert_seen(rec_var);
|
||||
for (index, (_name, variables)) in tags_vec.into_iter().enumerate() {
|
||||
if matches!(nullable, Some(i) if i == index as i64) {
|
||||
// don't add the
|
||||
|
@ -1163,6 +1163,7 @@ fn layout_from_flat_type<'a>(
|
|||
|
||||
tag_layouts.push(tag_layout.into_bump_slice());
|
||||
}
|
||||
env.remove_seen(rec_var);
|
||||
|
||||
let union_layout = if let Some(tag_id) = nullable {
|
||||
match tag_layouts.into_bump_slice() {
|
||||
|
@ -1186,8 +1187,6 @@ fn layout_from_flat_type<'a>(
|
|||
UnionLayout::Recursive(tag_layouts.into_bump_slice())
|
||||
};
|
||||
|
||||
env.remove_seen(rec_var);
|
||||
|
||||
Ok(Layout::Union(union_layout))
|
||||
}
|
||||
EmptyTagUnion => {
|
||||
|
@ -1422,10 +1421,6 @@ pub fn union_sorted_tags_help<'a>(
|
|||
seen: MutSet::default(),
|
||||
};
|
||||
|
||||
if let Some(rec_var) = opt_rec_var {
|
||||
env.insert_seen(rec_var);
|
||||
}
|
||||
|
||||
match tags_vec.len() {
|
||||
0 => {
|
||||
// trying to instantiate a type with no values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue