diff --git a/nac3core/src/toplevel/builtins.rs b/nac3core/src/toplevel/builtins.rs index f4a99ae31..0007286c3 100644 --- a/nac3core/src/toplevel/builtins.rs +++ b/nac3core/src/toplevel/builtins.rs @@ -255,9 +255,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { let arg_ty = fun.0.args[0].ty; let arg = args[0].1.clone().to_basic_value_enum(ctx, generator)?; Ok( - if ctx.unifier.unioned(arg_ty, boolean) - || ctx.unifier.unioned(arg_ty, int32) - { + if ctx.unifier.unioned(arg_ty, boolean) { Some( ctx.builder .build_int_z_extend( @@ -267,6 +265,16 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo { ) .into(), ) + } else if ctx.unifier.unioned(arg_ty, int32) { + Some( + ctx.builder + .build_int_s_extend( + arg.into_int_value(), + ctx.ctx.i64_type(), + "sext", + ) + .into(), + ) } else if ctx.unifier.unioned(arg_ty, int64) { Some(arg) } else if ctx.unifier.unioned(arg_ty, float) {