mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
pretty error messages for integers
This commit is contained in:
parent
308a24b080
commit
9d67b11c0d
10 changed files with 342 additions and 87 deletions
|
@ -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())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue