formatting & catch zig overflow error

This commit is contained in:
Folkert 2021-10-17 18:03:40 +02:00
parent 0cc6e44d35
commit 4152519bfb
7 changed files with 19 additions and 26 deletions

View file

@ -293,12 +293,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
// minInt : Int range
add_type!(Symbol::NUM_MIN_INT, int_type(flex(TVAR1)));
// divInt : Int a, Int a -> Result (Int a) [ DivByZero ]*
let div_by_zero = SolvedType::TagUnion(
vec![(TagName::Global("DivByZero".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
// divInt : Int a, Int a -> Result (Int a) [ DivByZero ]*
add_top_level_function_type!(
Symbol::NUM_DIV_INT,
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
@ -306,18 +306,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
);
//divCeil: Int a, Int a -> Result (Int a) [ DivByZero ]*
let div_by_zero = SolvedType::TagUnion(
vec![(TagName::Global("DivByZero".into()), vec![])],
Box::new(SolvedType::Wildcard),
);
add_top_level_function_type!(
Symbol::NUM_DIV_CEIL,
vec![int_type(flex(TVAR1)), int_type(flex(TVAR1))],
Box::new(result_type(int_type(flex(TVAR1)), div_by_zero.clone())),
);
// bitwiseAnd : Int a, Int a -> Int a
add_top_level_function_type!(
Symbol::NUM_BITWISE_AND,