mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Call insert_recursive for union layouts
This commit is contained in:
parent
59144f6e29
commit
37d9307fbf
3 changed files with 14 additions and 10 deletions
|
@ -1851,7 +1851,7 @@ fn modify_refcount_nonrecursive_help<'a, 'ctx, 'env>(
|
|||
mode.to_call_mode(fn_val),
|
||||
when_recursive,
|
||||
recursive_ptr_field_value,
|
||||
Layout::RECURSIVE_PTR,
|
||||
*field_layout,
|
||||
)
|
||||
} else if layout_interner.contains_refcounted(*field_layout) {
|
||||
let field_ptr = env
|
||||
|
|
|
@ -4102,7 +4102,10 @@ where
|
|||
};
|
||||
criteria.pass_through_recursive_union(rec_var);
|
||||
|
||||
let union_layout = env.cache.put_in(Layout::Union(union_layout));
|
||||
let union_layout = env
|
||||
.cache
|
||||
.interner
|
||||
.insert_recursive(env.arena, Layout::Union(union_layout));
|
||||
|
||||
Cacheable(Ok(union_layout), criteria)
|
||||
}
|
||||
|
|
|
@ -214,6 +214,12 @@ pub trait LayoutInterner<'a>: Sized {
|
|||
{
|
||||
self.get(layout).to_doc(alloc, self, parens)
|
||||
}
|
||||
|
||||
fn dbg(&self, layout: InLayout<'a>) -> String {
|
||||
let alloc: ven_pretty::Arena<()> = ven_pretty::Arena::new();
|
||||
let doc = self.to_doc(layout, &alloc, crate::ir::Parens::NotNeeded);
|
||||
doc.1.pretty(80).to_string()
|
||||
}
|
||||
}
|
||||
|
||||
/// An interned layout.
|
||||
|
@ -416,8 +422,6 @@ impl<'a> GlobalLayoutInterner<'a> {
|
|||
|
||||
let slot = unsafe { InLayout::from_index(vec.len()) };
|
||||
|
||||
// dbg!((normalized, normalized_hash, slot));
|
||||
|
||||
let lambda_set = LambdaSet {
|
||||
full_layout: slot,
|
||||
..normalized
|
||||
|
@ -790,12 +794,9 @@ mod reify {
|
|||
Layout::Union(un) => Layout::Union(reify_union(arena, interner, slot, un)),
|
||||
Layout::LambdaSet(ls) => Layout::LambdaSet(reify_lambda_set(arena, interner, slot, ls)),
|
||||
Layout::RecursivePointer(l) => {
|
||||
debug_assert_eq!(
|
||||
l,
|
||||
Layout::VOID,
|
||||
"normalized layouts must always have VOID as the recursive pointer!"
|
||||
);
|
||||
Layout::RecursivePointer(slot)
|
||||
// If the layout is not void at its point then it has already been solved as
|
||||
// another recursive union's layout, do not change it.
|
||||
Layout::RecursivePointer(if l == Layout::VOID { slot } else { l })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue