FLOAT_ABS test, and NUM_ABS generally, but not implemented

This commit is contained in:
Chad Stearns 2020-05-08 00:49:08 -04:00
parent be5641e35a
commit 8e8412bf94
6 changed files with 45 additions and 2 deletions

View file

@ -285,6 +285,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
SolvedType::Func(vec![int_type(), int_type()], Box::new(bool_type())),
);
// abs : Int -> Int
add_type(
Symbol::INT_ABS,
SolvedType::Func(vec![int_type()], Box::new(int_type())),
);
// highest : Int
add_type(Symbol::INT_HIGHEST, int_type());
@ -336,6 +342,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
SolvedType::Func(vec![float_type()], Box::new(int_type())),
);
// abs : Float -> Float
add_type(
Symbol::FLOAT_ABS,
SolvedType::Func(vec![float_type()], Box::new(float_type())),
);
// highest : Float
add_type(Symbol::FLOAT_HIGHEST, float_type());

View file

@ -354,6 +354,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
unique_function(vec![int_type(UVAR1), int_type(UVAR2)], bool_type(UVAR3)),
);
// abs :: Int -> Int
add_type(
Symbol::INT_ABS,
unique_function(vec![int_type(UVAR1)], int_type(UVAR2)),
);
// highest : Int
add_type(Symbol::INT_HIGHEST, int_type(UVAR1));
@ -418,6 +424,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
unique_function(vec![float_type(UVAR1)], int_type(UVAR2)),
);
// abs : Float -> Float
add_type(
Symbol::FLOAT_ABS,
unique_function(vec![float_type(UVAR1)], float_type(UVAR2)),
);
// highest : Float
add_type(Symbol::FLOAT_HIGHEST, float_type(UVAR1));