Clean up file and repl support for Num.maxI128

This commit is contained in:
Eric Henry 2021-03-12 17:48:55 -05:00
parent 66f07d984e
commit 3e4eb8d839
3 changed files with 15 additions and 1 deletions

1
Cargo.lock generated
View File

@ -2927,6 +2927,7 @@ dependencies = [
"pretty_assertions 0.5.1",
"quickcheck 0.8.5",
"quickcheck_macros 0.8.0",
"roc_builtins",
"roc_collections",
"roc_module",
"roc_parse",

View File

@ -82,6 +82,14 @@ fn jit_to_ast_help<'a>(
content
)))
}
Layout::Builtin(Builtin::Int128) => {
Ok(run_jit_function!(
lib,
main_fn_name,
i128,
|num| num_to_ast(env, i128_to_ast(env.arena, num), content)
))
}
Layout::Builtin(Builtin::Float64) => {
Ok(run_jit_function!(lib, main_fn_name, f64, |num| num_to_ast(
env,
@ -852,6 +860,12 @@ fn i64_to_ast(arena: &Bump, num: i64) -> Expr<'_> {
Expr::Num(arena.alloc(format!("{}", num)))
}
/// This is centralized in case we want to format it differently later,
/// e.g. adding underscores for large numbers
fn i128_to_ast(arena: &Bump, num: i128) -> Expr<'_> {
Expr::Num(arena.alloc(format!("{}", num)))
}
/// This is centralized in case we want to format it differently later,
/// e.g. adding underscores for large numbers
fn f64_to_ast(arena: &Bump, num: f64) -> Expr<'_> {

View File

@ -386,7 +386,6 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
// maxI128 : I128
add_type(Symbol::NUM_MAX_I128, i128_type());
//add_type(Symbol::NUM_MAX_I128, int_type(flex(TVAR1)));
// Float module