Invalidate layout-cached variables correctly after merging

This commit is contained in:
Ayaz Hafiz 2022-08-29 14:16:03 -05:00
parent 7a7a4fa680
commit 261cd75a71
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 16 additions and 1 deletions

View file

@ -5671,7 +5671,7 @@ fn convert_tag_union<'a>(
) {
Layout::Union(ul) => ul,
other => internal_error!(
"unexpected layout {:?} for {:?}",
"unexpected layout {:?} for {:?} ({:?})",
other,
roc_types::subs::SubsFmtContent(
env.subs.get_content_without_compacting(variant_var),
@ -5680,6 +5680,14 @@ fn convert_tag_union<'a>(
),
};
dbg!((
&union_layout,
roc_types::subs::SubsFmtContent(
env.subs.get_content_without_compacting(variant_var),
env.subs
)
));
use WrappedVariant::*;
let (tag, union_layout) = match variant {
Recursive { sorted_tag_layouts } => {

View file

@ -1982,6 +1982,13 @@ macro_rules! cached_or_impl {
if criteria.is_cacheable() {
// The computed layout is cacheable; insert it.
dbg!((
$var,
roc_types::subs::SubsFmtContent(
$self.subs.get_content_without_compacting($var),
$self.subs
)
));
$self
.cache
.$insert($self.subs, $var, result, criteria.cache_metadata());