diff --git a/compiler/tests/fixtures/build/interface_with_deps/AStar.roc b/compiler/tests/fixtures/build/interface_with_deps/AStar.roc index c48c171844..c03a88a7c5 100644 --- a/compiler/tests/fixtures/build/interface_with_deps/AStar.roc +++ b/compiler/tests/fixtures/build/interface_with_deps/AStar.roc @@ -5,11 +5,11 @@ interface AStar # a port of https://github.com/krisajenkins/elm-astar/blob/2.1.3/src/AStar/Generalised.elm -Model xyz : - { evaluated : Set xyz - , openSet : Set xyz - , costs : Map.Map xyz Float - , cameFrom : Map.Map xyz xyz +Model position : + { evaluated : Set position + , openSet : Set position + , costs : Map.Map position Float + , cameFrom : Map.Map position position } diff --git a/compiler/tests/test_uniqueness_load.rs b/compiler/tests/test_uniqueness_load.rs index d32c07f5dd..7feb688d80 100644 --- a/compiler/tests/test_uniqueness_load.rs +++ b/compiler/tests/test_uniqueness_load.rs @@ -222,6 +222,26 @@ mod test_uniqueness_load { }); } + #[test] + fn load_astar() { + test_async(async { + let subs_by_module = MutMap::default(); + let loaded_module = load_fixture("interface_with_deps", "AStar", subs_by_module).await; + + expect_types( + loaded_module, + hashmap! { + "findPath" => "Attr * (Attr * { costFunction : (Attr Shared (Attr Shared position, Attr Shared position -> Attr Shared Float)), end : (Attr Shared position), moveFunction : (Attr Shared (Attr Shared position -> Attr * (Set (Attr Shared position)))), start : (Attr Shared position) } -> Attr * (Result (Attr * (List (Attr Shared position))) (Attr * [ KeyNotFound ]*)))", + "initialModel" => "Attr * (Attr Shared position -> Attr * (Model (Attr Shared position)))", + "reconstructPath" => "Attr Shared (Attr Shared (Map (Attr Shared position) (Attr Shared position)), Attr Shared position -> Attr * (List (Attr Shared position)))", + "updateCost" => "Attr * (Attr Shared position, Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr Shared (Model (Attr Shared position)))", + "cheapestOpen" => "Attr * (Attr * (Attr Shared position -> Attr Shared Float), Attr * (Model (Attr Shared position)) -> Attr * (Result (Attr Shared position) (Attr * [ KeyNotFound ]*)))", + "astar" => "Attr Shared (Attr Shared (Attr Shared position, Attr Shared position -> Attr Shared Float), Attr Shared (Attr Shared position -> Attr * (Set (Attr Shared position))), Attr Shared position, Attr Shared (Model (Attr Shared position)) -> Attr * [ Err (Attr * [ KeyNotFound ]*), Ok (Attr * (List (Attr Shared position))) ]*)", + }, + ); + }); + } + #[test] fn load_and_typecheck_quicksort() { test_async(async {