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:
Ayaz Hafiz 2022-12-27 10:22:18 -06:00
parent bb0493918e
commit 7a6e68861c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 100 additions and 11 deletions

View file

@ -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
"###
)
}