mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
Merge pull request #1130 from rtfeldman/rc-missed-opt
fix missed RC optimization opportunity
This commit is contained in:
commit
4dc1018aee
1 changed files with 10 additions and 1 deletions
|
@ -441,7 +441,7 @@ fn expand_and_cancel<'a>(env: &mut Env<'a, '_>, stmt: &'a Stmt<'a>) -> &'a Stmt<
|
|||
structure,
|
||||
index,
|
||||
field_layouts,
|
||||
..
|
||||
wrapped,
|
||||
} => {
|
||||
let entry = env
|
||||
.alias_map
|
||||
|
@ -450,6 +450,15 @@ fn expand_and_cancel<'a>(env: &mut Env<'a, '_>, stmt: &'a Stmt<'a>) -> &'a Stmt<
|
|||
|
||||
entry.insert(*index, symbol);
|
||||
|
||||
// fixes https://github.com/rtfeldman/roc/issues/1099
|
||||
if matches!(
|
||||
wrapped,
|
||||
Wrapped::SingleElementRecord | Wrapped::RecordOrSingleTagUnion
|
||||
) {
|
||||
env.layout_map
|
||||
.insert(*structure, Layout::Struct(field_layouts));
|
||||
}
|
||||
|
||||
// if the field is a struct, we know its constructor too!
|
||||
let field_layout = &field_layouts[*index as usize];
|
||||
env.try_insert_struct_info(symbol, field_layout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue