pretty error messages for integers

This commit is contained in:
Folkert 2020-07-07 22:10:23 +02:00
parent 308a24b080
commit 9d67b11c0d
10 changed files with 342 additions and 87 deletions

View file

@ -21,7 +21,6 @@ use roc_types::subs::{VarStore, Variable};
use roc_types::types::Alias;
use std::fmt::Debug;
use std::i64;
use std::ops::Neg;
#[derive(Clone, Default, Debug, PartialEq)]
pub struct Output {
@ -625,13 +624,9 @@ pub fn canonicalize_expr<'a>(
base,
is_negative,
} => {
let mut result = finish_parsing_base(string, *base);
if *is_negative {
result = result.map(i64::neg);
}
let answer = int_expr_from_result(var_store, result, region, env);
// the minus sign is added before parsing, to get correct overflow/underflow behavior
let result = finish_parsing_base(string, *base, *is_negative);
let answer = int_expr_from_result(var_store, result, region, *base, env);
(answer, Output::default())
}