mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
consider tags that are represented as NULL
This commit is contained in:
parent
5250e930aa
commit
6f48c9762b
2 changed files with 17 additions and 17 deletions
|
@ -196,6 +196,16 @@ impl<'a> UnionLayout<'a> {
|
|||
UnionLayout::NonNullableUnwrapped(_) | UnionLayout::NullableUnwrapped { .. } => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tag_is_null(&self, tag_id: u8) -> bool {
|
||||
match self {
|
||||
UnionLayout::NonRecursive(_)
|
||||
| UnionLayout::NonNullableUnwrapped(_)
|
||||
| UnionLayout::Recursive(_) => false,
|
||||
UnionLayout::NullableWrapped { nullable_id, .. } => *nullable_id == tag_id as i64,
|
||||
UnionLayout::NullableUnwrapped { nullable_id, .. } => *nullable_id == (tag_id != 0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue