From 9a60f720d48103ce533f1f3f8284ff275d1b470e Mon Sep 17 00:00:00 2001 From: Ayaz Hafiz Date: Mon, 25 Jul 2022 10:53:29 -0400 Subject: [PATCH] Add reproduction for recursive ability impl specialization with inference --- crates/compiler/solve/tests/solve_expr.rs | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs index cf33d36bad..c055cbcbf4 100644 --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -6852,6 +6852,44 @@ mod solve_expr { ) } + #[test] + #[ignore = "TODO: this currently runs into trouble with ping and pong first being inferred as overly-general before recursive constraining"] + fn resolve_mutually_recursive_ability_lambda_sets_inferred() { + infer_queries!( + indoc!( + r#" + app "test" provides [main] to "./platform" + + Bounce has + ping : a -> a | a has Bounce + pong : a -> a | a has Bounce + + A := {} has [Bounce {ping, pong}] + + ping = \@A {} -> pong (@A {}) + #^^^^{-1} ^^^^ + + pong = \@A {} -> ping (@A {}) + #^^^^{-1} ^^^^ + + main = + a : A + a = ping (@A {}) + # ^^^^ + + a + "# + ), + @r###" + A#ping(5) : A -[[ping(5)]]-> A + Bounce#pong(3) : A -[[pong(6)]]-> A + A#pong(6) : A -[[pong(6)]]-> A + A#ping(5) : A -[[ping(5)]]-> A + A#ping(5) : A -[[ping(5)]]-> A + "### + ) + } + #[test] fn list_of_lambdas() { infer_queries!(