mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
only expand recursive tag unions if it's a different type (think linked-list of trees)
This commit is contained in:
parent
7701596469
commit
1bea704272
2 changed files with 7 additions and 2 deletions
|
@ -1665,7 +1665,12 @@ pub fn union_sorted_tags_help<'a>(
|
|||
has_any_arguments = true;
|
||||
|
||||
// make sure to not unroll recursive types!
|
||||
if opt_rec_var.is_some() && is_recursive_tag_union(&layout) {
|
||||
let self_recursion = opt_rec_var.is_some()
|
||||
&& subs.get_root_key_without_compacting(var)
|
||||
== subs.get_root_key_without_compacting(opt_rec_var.unwrap())
|
||||
&& is_recursive_tag_union(&layout);
|
||||
|
||||
if self_recursion {
|
||||
arg_layouts.push(Layout::RecursivePointer);
|
||||
} else {
|
||||
arg_layouts.push(layout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue