Commit graph

257 commits

Author SHA1 Message Date
Luke Boswell
e7e6978b0b
Merge remote-tracking branch 'remote/main' into builtin-json 2023-03-28 17:23:50 +11:00
Ayaz Hafiz
3f532df981
Generate code for recursive nullable wrapped lambda sets 2023-03-27 10:11:49 -05:00
Ayaz Hafiz
b8a0ff8e7c
Add a mono test for recursive lambda sets with late specialization 2023-03-27 10:11:26 -05:00
Luke Boswell
3fbfdc3e4a
remove expect assertion to satisfy mono, update mono 2023-03-26 20:46:23 +11:00
Luke Boswell
e73720605a
mono 2023-03-26 20:39:20 +11:00
Richard Feldman
72530916e5
Merge pull request #5204 from roc-lang/i4561
Check in mono test that works now
2023-03-25 21:58:16 -04:00
Ayaz Hafiz
18ee5d497c
Fix mono tests 2023-03-25 16:15:09 -05:00
Ayaz Hafiz
aef21741ec
Update mono tests 2023-03-25 16:14:30 -05:00
Ayaz Hafiz
dd55be6142
Handle guards that appear multiple times in a compiled decision tree
Suppose we have a when expression

```
15 if foo -> <b1>
b  if bar -> <b2>
_         -> <b3>
```

that may have a decision tree like

```
15?
  \true => foo?
              \true  => <b1>
              \false => bar?
                           \true  => <b2>
                           \false => <b3>
  \false => bar?
               \true  => <b2>
               \false => <b3>
```

In this case, the guard "bar?" appears twice in the compiled decision
tree. We need to materialize the guard expression in both locations in
the compiled tree, which means we cannot as-is stamp a compiled `bar?`
twice in each location. The reason is that

- the compiled joinpoint for each `bar?` guard needs to have a unique ID
- the guard expression might have call which needs unique call spec IDs,
  or other joins that need unique joinpoint IDs.

So, save the expression as we build up the decision tree and materialize
the guard each time we need it. In practice the guards should be quite
small, so duplicating should be fine. We could avoid duplication, but
it's not clear to me how to do that exactly since the branches after the
guard might end up being different.
2023-03-25 16:14:21 -05:00
Ayaz Hafiz
c13abb03be
Check in mono test that works now
Closes #4561
2023-03-25 15:58:39 -05:00
Ayaz Hafiz
5069d926bb
Update mono tests 2023-03-23 10:18:04 -05:00
Ayaz
6b3f3ba1a1
Merge pull request #5167 from roc-lang/fix-closure-captures-recursive
Ensure that closures inside recursive closures capture correctly
2023-03-21 13:53:33 -04:00
Richard Feldman
2276c78d9f
Merge pull request #5093 from roc-lang/glue-getters-rtfeldman
Glue for functions and closures
2023-03-21 08:12:19 -04:00
Ayaz Hafiz
700d2d1b31
Check in mono golden 2023-03-21 07:18:12 -04:00
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
Seth Workman
29e0673308
update dict.txt 2023-03-17 11:33:39 -05:00
Anton-4
f1b1aa6a7b
Merge branch 'main' of github.com:roc-lang/roc into glue-getters-rtfeldman 2023-03-17 11:34:29 +01:00
Brendan Hansknecht
00a3d7b259
update mono tests 2023-03-15 16:44:02 -07:00
Luke Boswell
90dd31aaca
update mono 2023-03-15 18:24:16 +11:00
Brendan Hansknecht
9e2a36f1d4
update mono 2023-03-13 18:03:05 -07:00
Folkert
fdf1489df6
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-14 01:01:26 +01:00
Folkert
3de3937553
disable a test that glue cannot handle 2023-03-13 21:30:12 +01:00
Brendan Hansknecht
85306953e9
update mono 2023-03-12 08:42:37 -07:00
Richard Feldman
512b9361bf
Merge pull request #5077 from lukewilliamboswell/builtin-json
JSON decoder improvements
2023-03-11 15:28:07 -05:00
Folkert
e9fc9dd3f9
update mono tests 2023-03-08 23:03:32 +01:00
Folkert
fe15a2e79c
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-08 19:46:00 +01:00
Luke Boswell
5d321e354b
update mono 2023-03-07 17:28:04 +11:00
Brendan Hansknecht
f42f61e271
run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08:00
Brendan Hansknecht
4a89bee0a5
centralize package versions except for vendor and excluded 2023-03-06 19:29:09 -08:00
Brendan Hansknecht
5485c8a5b0
update to using workspace package spec 2023-03-06 16:36:18 -08:00
Ayaz Hafiz
739bdfe64e
Fix a bug in chasing assigned/hole on switch 2023-03-05 22:19:16 -06:00
Ayaz Hafiz
7914b07a2f
Eliminate unneeded joinpoints in union lambda dispatches 2023-03-05 22:10:42 -06:00
Ayaz Hafiz
8e4de80aa9
Add test for enum lambda set elimination 2023-03-05 22:01:50 -06:00
Ayaz Hafiz
a2389c7652
Eliminate joinpoints in trivial lambda set switches 2023-03-05 21:59:01 -06:00
Ayaz Hafiz
7867ffb62b
Rename test 2023-03-05 21:47:06 -06:00
Ayaz Hafiz
fb5ac9fc6e
Check in failing reproduction for #5086 2023-03-05 21:40:10 -06:00
Folkert
d224992bc1
Merge remote-tracking branch 'origin/main' into glue-getters-rtfeldman 2023-03-05 17:24:05 +01:00
Luke Boswell
ac95c9a71a
update mono tests 2023-03-05 19:05:24 +11:00
Brendan Hansknecht
a86c8d7994
update mono tests 2023-02-27 16:36:08 -08:00
Folkert
454f3c603e
give the new exposed symbols to the surgical linker 2023-02-25 19:35:46 +01:00
Anton-4
4d91fe01ca
update mono tests 2023-02-24 14:35:05 +01:00
Folkert de Vries
34340de60c
Merge pull request #5020 from roc-lang/dev-unbox-u32
dev backend: reading and writing 32, 16 and 8-bit values
2023-02-21 17:33:21 +01:00
Ayaz Hafiz
fbc75016e1
Check in mono goldens 2023-02-20 19:31:22 -06:00
Ayaz Hafiz
d7a069675b
Lambda set compaction must preserve unique specializations of concrete types
There are times that multiple concrete types may appear in
unspecialized lambda sets that are being unified. The primary case is
during monomorphization, when unspecialized lambda sets join at the same
time that concrete types get instantiated. Since lambda set
specialization and compaction happens only after unifications are
complete, unifications that monomorphize can induce the above-described
situation.

In these cases,

- unspecialized lambda sets that are due to equivalent type variables
  can be compacted, since they are in fact the same specialization.
- unspecialized lambda sets that are due to different type variables
  cannot be compacted, even if their types unify, since they may point
  to different specializations. For example, consider the unspecialized
  lambda set `[[] + [A]:toEncoder:1 + [B]:toEncoder:1]` - this set wants
  two encoders, one for `[A]` and one for `[B]`, which is materially
  different from the set `[[] + [A, B]:toEncoder:1]`.
2023-02-20 18:50:07 -06:00
Folkert
aac8c76c5f
fix mono tests 2023-02-18 16:43:51 +01:00
Ayaz Hafiz
a3de22c88a
Do not fixup recursion pointers in non-recursive lambda sets
If a lambda set is non-recursive, but contains naked recursion pointers,
we should not fill those naked pointers in with the slot of the lambda
set during interning. Such naked pointers must belong to an encompassing
lambda set that is in fact recursive, and will be filled in later.

For example, `LambdaSet([Foo, LambdaSet(Bar, [<rec>])] as <rec>)` should
not have the inner lambda set's capture be filled in with itself.

Also, during reification of recursion pointers, we do not need to
traverse re-inserted lambda sets again, since they were just fixed-up.

Closes #5026
2023-02-13 17:14:04 -06:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
478d4a2d44
Support lambda sets with recursive pointers and their equivalence-checking 2023-01-25 17:57:49 -06:00
Ayaz Hafiz
0cd448eab4
Start ir-checking quicksort_help again
Closes #4694
2023-01-25 16:28:53 -06:00
Ayaz Hafiz
7754cc553c
Turn the ir-checker back on 2023-01-25 16:18:47 -06:00