mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Make sure to properly preserve lambda set ordering
This commit is contained in:
parent
1903ce4db9
commit
806e2f5096
3 changed files with 115 additions and 13 deletions
|
@ -1548,3 +1548,55 @@ fn multimorphic_lambda_set_capture() {
|
|||
"#
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn multimorphic_lambdas_with_other_lambda_capture() {
|
||||
indoc!(
|
||||
r#"
|
||||
capture : a -> ({} -> Str)
|
||||
capture = \val ->
|
||||
\{} ->
|
||||
when val is
|
||||
_ -> ""
|
||||
|
||||
capture2 = \val -> \{} -> "\(val)"
|
||||
|
||||
x : [A, B, C]
|
||||
x = A
|
||||
|
||||
fun =
|
||||
when x is
|
||||
A -> capture {}
|
||||
B -> capture2 "foo"
|
||||
C -> capture 1u64
|
||||
|
||||
fun {}
|
||||
"#
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn multimorphic_lambdas_with_non_capturing_function() {
|
||||
indoc!(
|
||||
r#"
|
||||
capture : a -> ({} -> Str)
|
||||
capture = \val ->
|
||||
\{} ->
|
||||
when val is
|
||||
_ -> ""
|
||||
|
||||
triv = \{} -> ""
|
||||
|
||||
x : [A, B, C]
|
||||
x = A
|
||||
|
||||
fun =
|
||||
when x is
|
||||
A -> capture {}
|
||||
B -> triv
|
||||
C -> capture 1u64
|
||||
|
||||
fun {}
|
||||
"#
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue