roc/crates/compiler/solve
Ayaz Hafiz e8a29d2df4
Ensure that closures inside recursive closures capture correctly
With a code like

```
thenDo = \x, callback ->
    callback x

f = \{} ->
    code = 10u16

    bf = \{} ->
        thenDo code \_ -> bf {}

    bf {}
```

The lambda `\_ -> bf {}` must capture `bf`. Previously, this would not
happen correctly, because we assumed that mutually recursive functions
(including singleton recursive functions, like `bf` here) cannot capture
themselves.

Of course, that premise does not hold in general. Instead, we should have
mutually recursive functions capture the closure (haha, get it) of
values captured by all functions constituting the mutual recursion.
Then, any nested closures can capture outer recursive closures' values
appropriately.
2023-03-20 17:44:59 -04:00
..
docs Add language to all fenced code blocks 2022-09-09 01:12:31 -06:00
src Fix formatting 2023-01-27 17:35:31 -06:00
tests Ensure that closures inside recursive closures capture correctly 2023-03-20 17:44:59 -04:00
Cargo.toml run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08:00