mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-03 06:02:54 +00:00
Resolve recursive pointer lambda set layouts when unpacking captures
This commit is contained in:
parent
549b00d327
commit
a4bb6879bc
1 changed files with 8 additions and 3 deletions
|
|
@ -3130,7 +3130,10 @@ fn specialize_external<'a>(
|
||||||
tag_id,
|
tag_id,
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
debug_assert!(matches!(union_layout, UnionLayout::NonRecursive(_)));
|
debug_assert!(matches!(
|
||||||
|
union_layout,
|
||||||
|
UnionLayout::NonRecursive(_) | UnionLayout::Recursive(_)
|
||||||
|
));
|
||||||
debug_assert_eq!(field_layouts.len(), captured.len());
|
debug_assert_eq!(field_layouts.len(), captured.len());
|
||||||
|
|
||||||
// captured variables are in symbol-alphabetic order, but now we want
|
// captured variables are in symbol-alphabetic order, but now we want
|
||||||
|
|
@ -3149,7 +3152,9 @@ fn specialize_external<'a>(
|
||||||
size2.cmp(&size1)
|
size2.cmp(&size1)
|
||||||
});
|
});
|
||||||
|
|
||||||
for (index, (symbol, layout)) in combined.iter().enumerate() {
|
for (index, (symbol, _)) in combined.iter().enumerate() {
|
||||||
|
let layout = union_layout.layout_at(tag_id, index);
|
||||||
|
|
||||||
let expr = Expr::UnionAtIndex {
|
let expr = Expr::UnionAtIndex {
|
||||||
tag_id,
|
tag_id,
|
||||||
structure: Symbol::ARG_CLOSURE,
|
structure: Symbol::ARG_CLOSURE,
|
||||||
|
|
@ -3162,7 +3167,7 @@ fn specialize_external<'a>(
|
||||||
specialized_body = Stmt::Let(
|
specialized_body = Stmt::Let(
|
||||||
symbol,
|
symbol,
|
||||||
expr,
|
expr,
|
||||||
**layout,
|
layout,
|
||||||
env.arena.alloc(specialized_body),
|
env.arena.alloc(specialized_body),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue