roc/crates
Ayaz Hafiz e97ce32b88
Fixup transient closure captures during canonicalization
Closure captures can be transient, but previously, we did not handle
that correctly. For example, in

```
x = ""
inner = \{} -> x
outer = \{} -> inner {}
```

`outer` captures `inner`, but `inner` captures `x`, and in the body of
`outer`, we would not construct the closure data for `inner` correctly
before calling it.

There are a couple ways around this.

1. Update mono to do something when we are passed the captured
   environment of a closure, rather than attempting to construct a
   call-by-name's captured environment before callign it.
2. Fix-up closures during canonicalization to remove captured closures
   that themselves capture, and replace them with their captures.

This patch does (2), since (1) is much more involved and is not likely
to bring a lot of wins. In general I think it's reasonable to expect
captured environments, even if transient, to be fairly shallow, so I
don't think this will produce very large closure environments.

Closes #2894
2022-08-13 10:25:17 -07:00
..
ast s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
cli Merge pull request #3739 from roc-lang/ruby-interop 2022-08-12 17:17:27 -04:00
cli_utils s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
code_markup updates for clippy 1.62 2022-07-05 12:39:27 +02:00
compiler Fixup transient closure captures during canonicalization 2022-08-13 10:25:17 -07:00
docs Merge pull request #3691 from rtfeldman/cargo_verson_change 2022-08-05 09:13:04 -04:00
docs_cli changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
editor s/trunk/main/g 2022-08-12 15:24:37 -04:00
error_macros s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
glue Fix strategy for fixing up pending recursive types 2022-08-12 10:40:39 -04:00
highlight changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
linker s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
repl_cli s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
repl_eval cargo fmt repl 2022-08-09 16:01:40 -07:00
repl_expect Merge remote-tracking branch 'origin/trunk' into roc-std-platform 2022-08-07 13:28:03 +02:00
repl_test Merge branch 'trunk' into i2147 2022-08-11 10:24:49 +02:00
repl_wasm wasm: add stack_bytes field to Env 2022-08-08 21:41:25 +01:00
reporting s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
roc_std Merge pull request #3751 from roc-lang/relax-clone 2022-08-13 00:11:23 +02:00
test_utils changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
utils changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
vendor s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
wasi-libc-sys s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00