mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Account for non-capturing functions in larger lambda sets passed to HOLLs
Previously, if the lambda set passed to a HOLL contained any function that captured, we would assume that the specialization of the HOLL we should make for each function in the lambda set that we dispatch to should capture. This is not right. Instead, we should specialize for each lambda in the set passed to the HOLL. The present patch enforces that, making sure that for each lambda in the set, we compute the exact proc layout needed to call the lambda, based on the captures of the specific lambda in the set, rather than looking at the set entirely.
This commit is contained in:
parent
bb0493918e
commit
7a6e68861c
3 changed files with 100 additions and 11 deletions
|
@ -2240,3 +2240,27 @@ fn issue_4717() {
|
|||
"###
|
||||
)
|
||||
}
|
||||
|
||||
#[mono_test]
|
||||
fn list_map_take_capturing_or_noncapturing() {
|
||||
indoc!(
|
||||
r###"
|
||||
app "test" provides [main] to "platform"
|
||||
|
||||
main =
|
||||
x = 1u8
|
||||
y = 2u8
|
||||
f = when "" is
|
||||
"A" ->
|
||||
g = \n -> n + x
|
||||
g
|
||||
"B" ->
|
||||
h = \n -> n + y
|
||||
h
|
||||
_ ->
|
||||
k = \n -> n + n
|
||||
k
|
||||
List.map [1u8, 2u8, 3u8] f
|
||||
"###
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue