Merge pull request #5167 from roc-lang/fix-closure-captures-recursive

Ensure that closures inside recursive closures capture correctly
This commit is contained in:
Ayaz 2023-03-21 13:53:33 -04:00 committed by GitHub
commit 6b3f3ba1a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 18 deletions

View file

@ -2769,3 +2769,23 @@ fn inline_return_joinpoints_in_union_lambda_set() {
"#
)
}
#[mono_test]
fn recursive_closure_with_transiently_used_capture() {
indoc!(
r#"
app "test" provides [f] to "./platform"
thenDo = \x, callback ->
callback x
f = \{} ->
code = 10u16
bf = \{} ->
thenDo code \_ -> bf {}
bf {}
"#
)
}