Merge pull request #4209 from roc-lang/impl-tag-discriminant

Derive `Hash` implementations for tag unions
This commit is contained in:
Ayaz 2022-10-10 22:23:05 -05:00 committed by GitHub
commit 83b64c4fb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 844 additions and 106 deletions

View file

@ -50,6 +50,7 @@ impl From<Layout<'_>> for CodeGenNumType {
|| internal_error!("Tried to perform a Num low-level operation on {:?}", layout);
match layout {
Layout::Builtin(builtin) => match builtin {
Builtin::Bool => I32,
Builtin::Int(int_width) => match int_width {
IntWidth::U8 => I32,
IntWidth::U16 => I32,
@ -1724,6 +1725,7 @@ impl<'a> LowLevelCall<'a> {
let arg_type = CodeGenNumType::from(arg_layout);
let arg_width = match arg_layout {
Layout::Builtin(Builtin::Int(w)) => w,
Layout::Builtin(Builtin::Bool) => IntWidth::U8,
x => internal_error!("Num.intCast is not defined for {:?}", x),
};