diff --git a/compiler/builtins/src/unique.rs b/compiler/builtins/src/unique.rs index 199bd14eda..224de39d2d 100644 --- a/compiler/builtins/src/unique.rs +++ b/compiler/builtins/src/unique.rs @@ -397,13 +397,13 @@ pub fn types() -> MutMap { // isEq or (==) : Attr u1 Bool, Attr u2 Bool -> Attr u3 Bool add_type( Symbol::BOOL_EQ, - unique_function(vec![bool_type(UVAR1), bool_type(UVAR2)], bool_type(UVAR3)), + unique_function(vec![flex(TVAR1), flex(TVAR2)], bool_type(UVAR3)), ); // isNeq or (!=) : Attr u1 Bool, Attr u2 Bool -> Attr u3 Bool add_type( Symbol::BOOL_NEQ, - unique_function(vec![bool_type(UVAR1), bool_type(UVAR2)], bool_type(UVAR3)), + unique_function(vec![flex(TVAR1), flex(TVAR2)], bool_type(UVAR3)), ); // and or (&&) : Attr u1 Bool, Attr u2 Bool -> Attr u3 Bool diff --git a/compiler/solve/tests/test_uniq_solve.rs b/compiler/solve/tests/test_uniq_solve.rs index dbc0343889..2f26288dae 100644 --- a/compiler/solve/tests/test_uniq_solve.rs +++ b/compiler/solve/tests/test_uniq_solve.rs @@ -1408,7 +1408,8 @@ mod test_uniq_solve { #[test] fn quicksort() { - infer_eq( + with_larger_debug_stack(|| { + infer_eq( indoc!( r#" quicksort : List (Num a), Int, Int -> List (Num a) @@ -1462,6 +1463,7 @@ mod test_uniq_solve { ), "Attr Shared (Attr b (List (Attr Shared (Num (Attr c a)))), Attr Shared Int, Attr Shared Int -> Attr b (List (Attr Shared (Num (Attr c a)))))" ); + }) } #[test] @@ -2083,7 +2085,8 @@ mod test_uniq_solve { reverse "# ), - "Attr * (Attr * (List (Attr (a | b) c)) -> Attr (* | a | b) (List (Attr a c)))", + "Attr * (Attr * (List (Attr (a | b) c)) -> Attr (* | a | b) (List (Attr b c)))", + //"Attr * (Attr * (List (Attr (a | b) c)) -> Attr (* | a | b) (List (Attr a c)))", ); } @@ -2327,18 +2330,17 @@ mod test_uniq_solve { Ok (reconstructPath model.cameFrom goal) else + modelPopped = { model & openSet : Set.remove model.openSet current, evaluated : Set.insert model.evaluated current } - modelPopped = { model & openSet : Set.remove model.openSet current, evaluated : Set.insert model.evaluated current } + neighbours = moveFn current - neighbours = moveFn current + newNeighbours = Set.diff neighbours modelPopped.evaluated - newNeighbours = Set.diff neighbours modelPopped.evaluated + modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours } - modelWithNeighbours = { modelPopped & openSet : Set.union modelPopped.openSet newNeighbours } + modelWithCosts = Set.foldl newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours - modelWithCosts = Set.foldl newNeighbours (\nb, md -> updateCost current nb md) modelWithNeighbours - - astar costFn moveFn goal modelWithCosts + astar costFn moveFn goal modelWithCosts findPath "# @@ -2348,6 +2350,18 @@ mod test_uniq_solve { }); } + #[test] + fn equals() { + infer_eq( + indoc!( + r#" + \a, b -> a == b + "# + ), + "Attr * (*, * -> Attr * Bool)", + ); + } + #[test] fn instantiated_alias() { infer_eq(