Merge branch 'trunk' into rvcas/list_functions

This commit is contained in:
Richard Feldman 2020-11-24 20:20:51 -05:00 committed by GitHub
commit e6fd9cd884
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 159 additions and 152 deletions

View file

@ -169,7 +169,7 @@ mod solve_expr {
#[test]
fn float_literal() {
infer_eq("0.5", "Float");
infer_eq("0.5", "F64");
}
#[test]
@ -762,7 +762,7 @@ mod solve_expr {
(\a -> a) 3.14
"#
),
"Float",
"F64",
);
}
@ -894,7 +894,7 @@ mod solve_expr {
// \l r -> l / r
// "#
// ),
// "Float, Float -> Float",
// "F64, F64 -> F64",
// );
// }
@ -906,7 +906,7 @@ mod solve_expr {
// 1 / 2
// "#
// ),
// "Float",
// "F64",
// );
// }
@ -1026,7 +1026,7 @@ mod solve_expr {
#[test]
fn two_field_record() {
infer_eq("{ x: 5, y : 3.14 }", "{ x : Num *, y : Float }");
infer_eq("{ x: 5, y : 3.14 }", "{ x : Num *, y : F64 }");
}
#[test]
@ -1414,12 +1414,12 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Float
float : F64
float
"#
),
"Float",
"F64",
);
}
@ -1433,7 +1433,7 @@ mod solve_expr {
float
"#
),
"Float",
"F64",
);
}
@ -1442,13 +1442,13 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Num.Float
float : Num.F64
float = 5.5
float
"#
),
"Float",
"F64",
);
}
@ -1457,13 +1457,13 @@ mod solve_expr {
infer_eq(
indoc!(
r#"
float : Float
float : F64
float = 5.5
float
"#
),
"Float",
"F64",
);
}
@ -1478,7 +1478,7 @@ mod solve_expr {
float
"#
),
"Float",
"F64",
);
}
@ -1578,7 +1578,7 @@ mod solve_expr {
float
"#
),
"Float",
"F64",
);
}
@ -1613,7 +1613,7 @@ mod solve_expr {
{ numIdentity, x : numIdentity 42, y }
"#
),
"{ numIdentity : Num a -> Num a, x : Num a, y : Float }",
"{ numIdentity : Num a -> Num a, x : Num a, y : F64 }",
);
}
@ -1791,7 +1791,7 @@ mod solve_expr {
threePointZero
"#
),
"Float",
"F64",
);
}
@ -2523,7 +2523,7 @@ mod solve_expr {
Num.toFloat
"#
),
"Num * -> Float",
"Num * -> F64",
);
}
@ -2535,7 +2535,7 @@ mod solve_expr {
Num.pow
"#
),
"Float, Float -> Float",
"F64, F64 -> F64",
);
}
@ -2547,7 +2547,7 @@ mod solve_expr {
Num.ceiling
"#
),
"Float -> Int",
"F64 -> Int",
);
}
@ -2559,7 +2559,7 @@ mod solve_expr {
Num.floor
"#
),
"Float -> Int",
"F64 -> Int",
);
}
@ -2583,7 +2583,7 @@ mod solve_expr {
Num.atan
"#
),
"Float -> Float",
"F64 -> F64",
);
}
@ -2850,7 +2850,7 @@ mod solve_expr {
negatePoint { x: 1, y: 2.1, z: 0x3 }
"#
),
"{ x : Num a, y : Float, z : Int }",
"{ x : Num a, y : F64, z : Int }",
);
}
@ -2867,7 +2867,7 @@ mod solve_expr {
{ a, b }
"#
),
"{ a : { x : Num a, y : Float, z : c }, b : { blah : Str, x : Num a, y : Float, z : c } }",
"{ a : { x : Num a, y : F64, z : c }, b : { blah : Str, x : Num a, y : F64, z : c } }",
);
}

View file

@ -75,7 +75,7 @@ mod solve_uniq_expr {
#[test]
fn float_literal() {
infer_eq("0.5", "Attr * Float");
infer_eq("0.5", "Attr * F64");
}
#[test]
@ -640,7 +640,7 @@ mod solve_uniq_expr {
(\a -> a) 3.14
"#
),
"Attr * Float",
"Attr * F64",
);
}
@ -773,7 +773,7 @@ mod solve_uniq_expr {
// \l r -> l / r
// "#
// ),
// "Float, Float -> Float",
// "F64, F64 -> F64",
// );
// }
@ -785,7 +785,7 @@ mod solve_uniq_expr {
// 1 / 2
// "#
// ),
// "Float",
// "F64",
// );
// }
@ -1211,7 +1211,7 @@ mod solve_uniq_expr {
{ numIdentity, p, q }
"#
),
"Attr * { numIdentity : Attr Shared (Attr b (Num (Attr a p)) -> Attr b (Num (Attr a p))), p : Attr * (Num (Attr * p)), q : Attr * Float }"
"Attr * { numIdentity : Attr Shared (Attr b (Num (Attr a p)) -> Attr b (Num (Attr a p))), p : Attr * (Num (Attr * p)), q : Attr * F64 }"
);
}
@ -1831,7 +1831,7 @@ mod solve_uniq_expr {
infer_eq(
indoc!(
r#"
Foo : { x : Str, y : Float }
Foo : { x : Str, y : F64 }
{ x, y } : Foo
{ x, y } = { x : "foo", y : 3.14 }
@ -1848,7 +1848,7 @@ mod solve_uniq_expr {
infer_eq(
indoc!(
r#"
Foo : { x : Str, y : Float }
Foo : { x : Str, y : F64 }
Bar : Foo
@ -2113,7 +2113,7 @@ mod solve_uniq_expr {
Num.maxFloat / Num.maxFloat
"#
),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))",
"Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
);
}
@ -2125,7 +2125,7 @@ mod solve_uniq_expr {
3.0 / 4.0
"#
),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))",
"Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
);
}
@ -2137,7 +2137,7 @@ mod solve_uniq_expr {
3.0 / Num.maxFloat
"#
),
"Attr * (Result (Attr * Float) (Attr * [ DivByZero ]*))",
"Attr * (Result (Attr * F64) (Attr * [ DivByZero ]*))",
);
}
@ -2772,11 +2772,11 @@ mod solve_uniq_expr {
r#"
Model position : { evaluated : Set position
, openSet : Set position
, costs : Map.Map position Float
, costs : Map.Map position F64
, cameFrom : Map.Map position position
}
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]*
cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar ->
@ -2802,7 +2802,7 @@ mod solve_uniq_expr {
cheapestOpen
"#
),
"Attr * (Attr * (Attr Shared position -> Attr * Float), Attr (* | * | a | b) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))"
"Attr * (Attr * (Attr Shared position -> Attr * F64), Attr (* | * | a | b) (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))"
)
});
}
@ -2815,7 +2815,7 @@ mod solve_uniq_expr {
r#"
Model position : { evaluated : Set position
, openSet : Set position
, costs : Map.Map position Float
, costs : Map.Map position F64
, cameFrom : Map.Map position position
}
@ -2867,7 +2867,7 @@ mod solve_uniq_expr {
r#"
Model position : { evaluated : Set position
, openSet : Set position
, costs : Map.Map position Float
, costs : Map.Map position F64
, cameFrom : Map.Map position position
}
@ -2881,7 +2881,7 @@ mod solve_uniq_expr {
}
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]*
cheapestOpen : (position -> F64), Model position -> Result position [ KeyNotFound ]*
cheapestOpen = \costFunction, model ->
folder = \position, resSmallestSoFar ->
@ -2941,12 +2941,12 @@ mod solve_uniq_expr {
model
findPath : { costFunction: (position, position -> Float), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]*
findPath : { costFunction: (position, position -> F64), moveFunction: (position -> Set position), start : position, end : position } -> Result (List position) [ KeyNotFound ]*
findPath = \{ costFunction, moveFunction, start, end } ->
astar costFunction moveFunction end (initialModel start)
astar : (position, position -> Float), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*
astar : (position, position -> F64), (position -> Set position), position, Model position -> [ Err [ KeyNotFound ]*, Ok (List position) ]*
astar = \costFn, moveFn, goal, model ->
when cheapestOpen (\position -> costFn goal position) model is
Err _ ->
@ -2972,7 +2972,7 @@ mod solve_uniq_expr {
findPath
"#
),
"Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * Float), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))"
"Attr * (Attr * { costFunction : Attr Shared (Attr Shared position, Attr Shared position -> Attr * F64), end : Attr Shared position, moveFunction : Attr Shared (Attr Shared position -> Attr * (Set (Attr * position))), start : Attr Shared position } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))"
)
});
}
@ -3071,7 +3071,7 @@ mod solve_uniq_expr {
negatePoint { x: 1, y: 2.1, z: 0x3 }
"#
),
"Attr * { x : Attr * (Num (Attr * a)), y : Attr * Float, z : Attr * Int }",
"Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * Int }",
);
}
@ -3088,7 +3088,7 @@ mod solve_uniq_expr {
{ a, b }
"#
),
"Attr * { a : Attr * { x : Attr * (Num (Attr * a)), y : Attr * Float, z : Attr * c }, b : Attr * { blah : Attr * Str, x : Attr * (Num (Attr * a)), y : Attr * Float, z : Attr * c } }"
"Attr * { a : Attr * { x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * c }, b : Attr * { blah : Attr * Str, x : Attr * (Num (Attr * a)), y : Attr * F64, z : Attr * c } }"
);
}