mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
give maxI128 an explicit annotation
This commit is contained in:
parent
91c1b6c382
commit
2031488d1a
3 changed files with 16 additions and 1 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -2750,6 +2750,7 @@ dependencies = [
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
"quickcheck",
|
"quickcheck",
|
||||||
"quickcheck_macros",
|
"quickcheck_macros",
|
||||||
|
"roc_builtins",
|
||||||
"roc_collections",
|
"roc_collections",
|
||||||
"roc_module",
|
"roc_module",
|
||||||
"roc_parse",
|
"roc_parse",
|
||||||
|
|
|
@ -12,6 +12,7 @@ roc_module = { path = "../module" }
|
||||||
roc_parse = { path = "../parse" }
|
roc_parse = { path = "../parse" }
|
||||||
roc_problem = { path = "../problem" }
|
roc_problem = { path = "../problem" }
|
||||||
roc_types = { path = "../types" }
|
roc_types = { path = "../types" }
|
||||||
|
roc_builtins = { path = "../builtins" }
|
||||||
ven_graph = { path = "../../vendor/pathfinding" }
|
ven_graph = { path = "../../vendor/pathfinding" }
|
||||||
im = "14" # im and im-rc should always have the same version!
|
im = "14" # im and im-rc should always have the same version!
|
||||||
im-rc = "14" # im and im-rc should always have the same version!
|
im-rc = "14" # im and im-rc should always have the same version!
|
||||||
|
|
|
@ -293,6 +293,7 @@ pub fn builtin_defs(var_store: &mut VarStore) -> MutMap<Symbol, Def> {
|
||||||
Symbol::NUM_SHIFT_RIGHT => num_shift_right_by,
|
Symbol::NUM_SHIFT_RIGHT => num_shift_right_by,
|
||||||
Symbol::NUM_SHIFT_RIGHT_ZERO_FILL => num_shift_right_zf_by,
|
Symbol::NUM_SHIFT_RIGHT_ZERO_FILL => num_shift_right_zf_by,
|
||||||
Symbol::NUM_INT_CAST=> num_int_cast,
|
Symbol::NUM_INT_CAST=> num_int_cast,
|
||||||
|
Symbol::NUM_MAX_I128=> num_max_i128,
|
||||||
Symbol::RESULT_MAP => result_map,
|
Symbol::RESULT_MAP => result_map,
|
||||||
Symbol::RESULT_MAP_ERR => result_map_err,
|
Symbol::RESULT_MAP_ERR => result_map_err,
|
||||||
Symbol::RESULT_AFTER => result_after,
|
Symbol::RESULT_AFTER => result_after,
|
||||||
|
@ -1351,8 +1352,20 @@ fn num_max_i128(symbol: Symbol, var_store: &mut VarStore) -> Def {
|
||||||
let int_percision_var = var_store.fresh();
|
let int_percision_var = var_store.fresh();
|
||||||
let body = Int(int_var, int_percision_var, i128::MAX);
|
let body = Int(int_var, int_percision_var, i128::MAX);
|
||||||
|
|
||||||
|
let std = roc_builtins::std::types();
|
||||||
|
let solved = std.get(&symbol).unwrap();
|
||||||
|
let mut free_vars = roc_types::solved_types::FreeVars::default();
|
||||||
|
let signature = roc_types::solved_types::to_type(&solved.0, &mut free_vars, var_store);
|
||||||
|
|
||||||
|
let annotation = crate::def::Annotation {
|
||||||
|
signature,
|
||||||
|
introduced_variables: Default::default(),
|
||||||
|
region: Region::zero(),
|
||||||
|
aliases: Default::default(),
|
||||||
|
};
|
||||||
|
|
||||||
Def {
|
Def {
|
||||||
annotation: None,
|
annotation: Some(annotation),
|
||||||
expr_var: int_var,
|
expr_var: int_var,
|
||||||
loc_expr: Located::at_zero(body),
|
loc_expr: Located::at_zero(body),
|
||||||
loc_pattern: Located::at_zero(Pattern::Identifier(symbol)),
|
loc_pattern: Located::at_zero(Pattern::Identifier(symbol)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue