mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Register types for Num.pow
This commit is contained in:
parent
ad0a214dbf
commit
d0864608fd
3 changed files with 27 additions and 0 deletions
|
@ -412,6 +412,12 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
||||||
// minFloat : Float
|
// minFloat : Float
|
||||||
add_type(Symbol::NUM_MIN_FLOAT, float_type());
|
add_type(Symbol::NUM_MIN_FLOAT, float_type());
|
||||||
|
|
||||||
|
// pow : Float, Float -> Float
|
||||||
|
add_type(
|
||||||
|
Symbol::NUM_POW,
|
||||||
|
SolvedType::Func(vec![float_type(), float_type()], Box::new(float_type())),
|
||||||
|
);
|
||||||
|
|
||||||
// Bool module
|
// Bool module
|
||||||
|
|
||||||
// and : Bool, Bool -> Bool
|
// and : Bool, Bool -> Bool
|
||||||
|
|
|
@ -448,6 +448,15 @@ pub fn types() -> MutMap<Symbol, (SolvedType, Region)> {
|
||||||
unique_function(vec![num_type(star1, a)], bool_type(star2))
|
unique_function(vec![num_type(star1, a)], bool_type(star2))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// pow : Float, Float -> Float
|
||||||
|
add_type(Symbol::NUM_POW, {
|
||||||
|
let_tvars! { star1, star2, star3 };
|
||||||
|
unique_function(
|
||||||
|
vec![float_type(star1), float_type(star2)],
|
||||||
|
float_type(star3),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
// Bool module
|
// Bool module
|
||||||
|
|
||||||
// isEq or (==) : Attr * a, Attr * a -> Attr * Bool
|
// isEq or (==) : Attr * a, Attr * a -> Attr * Bool
|
||||||
|
|
|
@ -2382,6 +2382,18 @@ mod solve_expr {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pow() {
|
||||||
|
infer_eq_without_problem(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
Num.pow
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Float, Float -> Float",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reconstruct_path() {
|
fn reconstruct_path() {
|
||||||
infer_eq_without_problem(
|
infer_eq_without_problem(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue