mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
make bool intern with semanctis
This commit is contained in:
parent
f1375b27cc
commit
0adf075123
3 changed files with 6 additions and 7 deletions
|
@ -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())),
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 }))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue