mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +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
|
@ -19,7 +19,7 @@ use roc_types::subs::{Content, FlatType, Subs, Variable};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use ven_pretty::{BoxAllocator, DocAllocator, DocBuilder};
|
use ven_pretty::{BoxAllocator, DocAllocator, DocBuilder};
|
||||||
|
|
||||||
pub const PRETTY_PRINT_IR_SYMBOLS: bool = true;
|
pub const PRETTY_PRINT_IR_SYMBOLS: bool = false;
|
||||||
|
|
||||||
macro_rules! return_on_layout_error {
|
macro_rules! return_on_layout_error {
|
||||||
($env:expr, $layout_result:expr) => {
|
($env:expr, $layout_result:expr) => {
|
||||||
|
|
|
@ -1665,7 +1665,12 @@ pub fn union_sorted_tags_help<'a>(
|
||||||
has_any_arguments = true;
|
has_any_arguments = true;
|
||||||
|
|
||||||
// make sure to not unroll recursive types!
|
// 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);
|
arg_layouts.push(Layout::RecursivePointer);
|
||||||
} else {
|
} else {
|
||||||
arg_layouts.push(layout);
|
arg_layouts.push(layout);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue