mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
don't pass closure argument if not expected
This commit is contained in:
parent
c68689a52b
commit
7416cc4e81
3 changed files with 52 additions and 3 deletions
|
@ -2790,6 +2790,9 @@ fn mix_function_and_closure() {
|
|||
r#"
|
||||
app "test" provides [ main ] to "./platform"
|
||||
|
||||
# foo does not capture any variables
|
||||
# but through unification will get a lambda set that does store information
|
||||
# we must handle that correctly
|
||||
foo = \x -> x
|
||||
|
||||
bar = \y -> \_ -> y
|
||||
|
@ -2803,3 +2806,26 @@ fn mix_function_and_closure() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mix_function_and_closure_level_of_indirection() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [ main ] to "./platform"
|
||||
|
||||
foo = \x -> x
|
||||
|
||||
bar = \y -> \_ -> y
|
||||
|
||||
f = (if 1 == 1 then foo else (bar "nope nope nope"))
|
||||
|
||||
main : Str
|
||||
main =
|
||||
f "hello world"
|
||||
"#
|
||||
),
|
||||
RocStr::from_slice(b"hello world"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue