Fixed erased with nullable unwrapped union

This commit is contained in:
Ayaz Hafiz 2023-07-12 16:01:44 -05:00
parent 5e9a06e537
commit 937e042c8f
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 105 additions and 10 deletions

View file

@ -1,6 +1,6 @@
use roc_target::TargetInfo;
use super::{InLayout, LayoutRepr};
use super::{InLayout, LayoutRepr, UnionLayout};
/// The layout of an erasure.
///
@ -56,11 +56,17 @@ impl Erased {
}
}
impl<'a> LayoutRepr<'a> {
pub fn boxed_erased_value(value: &'a InLayout<'a>) -> Self {
Self::Union(super::UnionLayout::NullableUnwrapped {
impl<'a> UnionLayout<'a> {
pub(crate) fn boxed_erased_value(value: &'a InLayout<'a>) -> Self {
UnionLayout::NullableUnwrapped {
nullable_id: true,
other_fields: std::slice::from_ref(value),
})
}
}
}
impl<'a> LayoutRepr<'a> {
pub(crate) fn boxed_erased_value(value: &'a InLayout<'a>) -> Self {
Self::Union(UnionLayout::boxed_erased_value(value))
}
}