roc/crates/compiler/test_mono
Ayaz Hafiz 9181ed8092
Correctly compile rvalue closures defined in nested defines to lvalues
Previously, a program like

```
main =
  f =
    n = 1
    \{} -[#lam]-> n  # suppose lambda set = #lam
  f {}
```

would be transformed to

```
main =
  n = 1
  f = \{} -[#lam]-> n
  f {}
```

However, the IR lowering procedure is such that we would then associate
`f` as definining the procedure given the lambda set `#lam`. This is not
correct, as `f` is really a function pointer in this circumstance,
rather than the definer of `#lam`.

Instead, the transformation we want to perform is

```
main =
  n = 1
  #lam = \{} -[#lam]-> n
  f = #lam
  f {}
```

Which is what this patch does

Closes #2403
2022-12-01 15:47:18 -06:00
..
generated Correctly compile rvalue closures defined in nested defines to lvalues 2022-12-01 15:47:18 -06:00
src Correctly compile rvalue closures defined in nested defines to lvalues 2022-12-01 15:47:18 -06:00
Cargo.toml Provide roc_cache_dir everywhere 2022-11-20 19:53:48 -05:00