mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
add different variants of addition
This commit is contained in:
parent
455b73e8bd
commit
fb4a796e07
9 changed files with 136 additions and 53 deletions
|
@ -188,8 +188,8 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
);
|
||||
|
||||
// addChecked or (+) : Num a, Num a -> Result (Num a) [ IntOverflow ]*
|
||||
let int_overflow = SolvedType::TagUnion(
|
||||
vec![(TagName::Global("IntOverflow".into()), vec![])],
|
||||
let overflow = SolvedType::TagUnion(
|
||||
vec![(TagName::Global("Overflow".into()), vec![])],
|
||||
Box::new(SolvedType::Wildcard),
|
||||
);
|
||||
|
||||
|
@ -197,7 +197,7 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
|||
Symbol::NUM_ADD_CHECKED,
|
||||
SolvedType::Func(
|
||||
vec![num_type(flex(TVAR1)), num_type(flex(TVAR1))],
|
||||
Box::new(result_type(num_type(flex(TVAR1)), int_overflow)),
|
||||
Box::new(result_type(num_type(flex(TVAR1)), overflow)),
|
||||
),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue