make bool intern with semanctis

This commit is contained in:
Folkert 2023-05-17 17:33:05 +02:00
parent f1375b27cc
commit 0adf075123
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 6 additions and 7 deletions

View file

@ -4134,9 +4134,7 @@ where
Unit => env
.cache
.put_in(Layout::new(LayoutRepr::UNIT, compute_semantic())),
BoolUnion { .. } => env
.cache
.put_in(Layout::new(LayoutRepr::BOOL, compute_semantic())),
BoolUnion { .. } => Layout::BOOL,
ByteUnion(_) => env
.cache
.put_in(Layout::new(LayoutRepr::U8, compute_semantic())),

View file

@ -59,7 +59,7 @@ macro_rules! nosema {
cache_interned_layouts! {
0, VOID, pub, Layout::VOID_NAKED
1, UNIT, pub, Layout::UNIT_NAKED
2, BOOL, pub, nosema!(LayoutRepr::BOOL)
2, BOOL, pub, Layout { repr: LayoutRepr::BOOL, semantic: SemanticRepr::BOOL }
3, U8, pub, nosema!(LayoutRepr::U8)
4, U16, pub, nosema!(LayoutRepr::U16)
5, U32, pub, nosema!(LayoutRepr::U32)

View file

@ -27,20 +27,21 @@ enum Inner<'a> {
impl<'a> SemanticRepr<'a> {
pub(super) const NONE: Self = Self(Inner::None);
pub(super) const EMPTY_RECORD: Self = Self::record(&[]);
pub(super) const BOOL: Self = Self::tag_union(&["False", "True"]);
pub(super) const fn record(fields: &'a [&'a str]) -> Self {
Self(Inner::Record(SemaRecord { fields }))
}
pub(super) fn tuple(size: usize) -> Self {
pub(super) const fn tuple(size: usize) -> Self {
Self(Inner::Tuple(SemaTuple { size }))
}
pub(super) fn tag_union(tags: &'a [&'a str]) -> Self {
pub(super) const fn tag_union(tags: &'a [&'a str]) -> Self {
Self(Inner::TagUnion(SemaTagUnion { tags }))
}
pub(super) fn lambdas(lambdas: &'a [Symbol]) -> Self {
pub(super) const fn lambdas(lambdas: &'a [Symbol]) -> Self {
Self(Inner::Lambdas(SemaLambdas { lambdas }))
}
}