mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Merge pull request #6887 from roc-lang/in-layout-unit
This commit is contained in:
commit
eca229e3d1
1 changed files with 27 additions and 23 deletions
|
@ -3362,6 +3362,9 @@ fn layout_from_flat_type<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if sortables.is_empty() {
|
||||||
|
Cacheable(Ok(Layout::UNIT), criteria)
|
||||||
|
} else {
|
||||||
sortables.sort_by(|(label1, layout1), (label2, layout2)| {
|
sortables.sort_by(|(label1, layout1), (label2, layout2)| {
|
||||||
cmp_fields(&env.cache.interner, label1, *layout1, label2, *layout2)
|
cmp_fields(&env.cache.interner, label1, *layout1, label2, *layout2)
|
||||||
});
|
});
|
||||||
|
@ -3382,13 +3385,14 @@ fn layout_from_flat_type<'a>(
|
||||||
inner_repr.newtype()
|
inner_repr.newtype()
|
||||||
} else {
|
} else {
|
||||||
let layouts = Vec::from_iter_in(sortables.into_iter().map(|t| t.1), arena);
|
let layouts = Vec::from_iter_in(sortables.into_iter().map(|t| t.1), arena);
|
||||||
LayoutRepr::Struct(layouts.into_bump_slice()).direct()
|
LayoutRepr::struct_(layouts.into_bump_slice()).direct()
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = Ok(env.cache.put_in(Layout { repr, semantic }));
|
let result = Ok(env.cache.put_in(Layout { repr, semantic }));
|
||||||
|
|
||||||
Cacheable(result, criteria)
|
Cacheable(result, criteria)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Tuple(elems, ext_var) => {
|
Tuple(elems, ext_var) => {
|
||||||
let mut criteria = CACHEABLE;
|
let mut criteria = CACHEABLE;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue