mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 06:55:15 +00:00
Add gen test for recursion var resolved upon specialization
This commit is contained in:
parent
b8a0ff8e7c
commit
0f73c25c0c
1 changed files with 23 additions and 0 deletions
|
@ -4335,3 +4335,26 @@ fn when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176() {
|
|||
u8
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn recursive_lambda_set_resolved_only_upon_specialization() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
factCPS = \n, cont ->
|
||||
if n == 0 then
|
||||
cont 1
|
||||
else
|
||||
factCPS (n - 1) \value -> cont (n * value)
|
||||
|
||||
main =
|
||||
factCPS 5u64 \x -> x
|
||||
"#
|
||||
),
|
||||
120,
|
||||
u64
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue