mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Multimorphic lambdas capture another lambda
This commit is contained in:
parent
b69d538ea0
commit
28c1cf46a3
5 changed files with 175 additions and 63 deletions
|
@ -1600,3 +1600,32 @@ fn multimorphic_lambdas_with_non_capturing_function() {
|
|||
"#
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn multimorphic_lambdas_have_captured_function_in_closure() {
|
||||
indoc!(
|
||||
r#"
|
||||
Lazy a : {} -> a
|
||||
|
||||
after : Lazy a, (a -> Lazy b) -> Lazy b
|
||||
after = \effect, map ->
|
||||
thunk = \{} ->
|
||||
when map (effect {}) is
|
||||
b -> b {}
|
||||
thunk
|
||||
|
||||
f = \_ -> \_ -> ""
|
||||
g = \{ s1 } -> \_ -> s1
|
||||
|
||||
x : [True, False]
|
||||
x = True
|
||||
|
||||
fun =
|
||||
when x is
|
||||
True -> after (\{} -> "") f
|
||||
False -> after (\{} -> {s1: "s1"}) g
|
||||
|
||||
fun {}
|
||||
"#
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue