mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Support upcasting bools to ints in the wasm backend
This commit is contained in:
parent
725054b8f3
commit
c7bd4e1c1c
1 changed files with 2 additions and 0 deletions
|
@ -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,
|
||||
|
@ -1723,6 +1724,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),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue