fix expected type

Rust's u128 and Roc's U128 have different alignment. They can not be used interchangebly, that leads to segmentation faults. See also 434410692
This commit is contained in:
Anton-4 2024-04-20 19:57:47 +02:00
parent 99ca3f545f
commit c1d0c24194
No known key found for this signature in database
GPG key ID: 0971D718C0A9B937
6 changed files with 181 additions and 99 deletions

View file

@ -13,7 +13,7 @@ use crate::helpers::dev::assert_evals_to as assert_llvm_evals_to;
#[allow(unused_imports)]
use indoc::indoc;
#[allow(unused_imports)]
use roc_std::{RocList, RocResult, RocStr};
use roc_std::{RocList, RocResult, RocStr, I128, U128};
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
@ -1345,8 +1345,8 @@ fn str_to_i128() {
Str.toI128 "1"
"#
),
RocResult::ok(1),
RocResult<i128, ()>
RocResult::ok(I128::from(1)),
RocResult<I128, ()>
);
}
@ -1359,11 +1359,12 @@ fn str_to_u128() {
Str.toU128 "1"
"#
),
RocResult::ok(1),
RocResult<u128, ()>
RocResult::ok(U128::from(1)),
RocResult<U128, ()>
);
}
// TODO add alignment check between i64 and I64 somewhere
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))]
fn str_to_i64() {