Commit graph

193 commits

Author SHA1 Message Date
Ayaz Hafiz
b8712bcb30
Weaken records in let-bindings
This change also means we must update the interface of `Dict.empty` and
`Set.empty` from

```
Dict.empty : Dict k v
```

to

```
Dict.empty : {} -> Dict k v
```
2023-01-14 15:33:51 +01:00
Ayaz Hafiz
cb1373a3a4
Weaken let-binding calls 2023-01-14 15:33:49 +01:00
Ayaz Hafiz
b2cdddbdfb
Weaken lists 2023-01-12 10:02:20 -06:00
Folkert
cf15654ee5
implement standard as patterns in mono IR 2023-01-11 14:18:13 +01:00
Ayaz Hafiz
ba2527a020
Check in mono test case 2023-01-09 16:35:25 -06:00
Ayaz Hafiz
b2688dd3b1
Skip nullable ID in nullable wrapped tags when iterating 2023-01-09 11:54:51 -06:00
Ayaz
7076c889a5
Merge pull request #4828 from roc-lang/refactor-build
Refactor build
2022-12-29 18:41:22 -06:00
Ayaz
858670fac7
Merge pull request #4833 from roc-lang/intern-layouts
Intern all the layouts
2022-12-29 18:28:44 -06:00
Ayaz Hafiz
3aab378bab
Correct pattern matching of nullable wrapped tag unions
The nullable ID always has zero tags. For everything else, we should
just match with the arity of the number of arguments, which doesn't
include the tag ID.
2022-12-29 12:22:05 -06:00
Folkert
26e5ac85d4
remove argument from the from_str functions 2022-12-29 16:50:19 +01:00
Ayaz Hafiz
dd6a72fc46
Update mono tests
These have changed because of how interned layouts are now sorted.
2022-12-28 18:50:50 -06:00
Ayaz Hafiz
7045001f64
Intern captures layouts 2022-12-28 17:05:04 -06:00
Ayaz
562a2748cb
Merge branch 'main' into i4732
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-12-28 11:56:08 -06:00
Ayaz
fe2bab56f9
Merge pull request #4819 from roc-lang/i4717
Compile anonymous closures with multiple specializations, and various fixes to lambda set compilation
2022-12-28 11:45:04 -06:00
Folkert de Vries
f4894183d7
Merge pull request #4823 from roc-lang/fix-check-union
Fix checking of recursive layouts in the ir-checker
2022-12-28 16:20:01 +01:00
Ayaz
b400851586
Merge branch 'main' into i4717
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-12-27 18:58:16 -06:00
Ayaz Hafiz
76d4bea0f3
Require no_check to have an associated annotation 2022-12-27 12:50:53 -06:00
Ayaz Hafiz
09c38798e5
Start checking mono tests that now check correctly 2022-12-27 12:49:30 -06:00
Ayaz Hafiz
23fc7f1413
Appropriately substitute symbols in switch conditions
Closes #4557
2022-12-27 12:29:23 -06:00
Ayaz Hafiz
a818b810f2
Better name for #4717 repro case 2022-12-27 11:05:12 -06:00
Ayaz Hafiz
7a6e68861c
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.
2022-12-27 10:22:18 -06:00
Ayaz Hafiz
1e847efbfe
Correctly choose specialized shapes for anonymous closures 2022-12-27 09:18:41 -06:00
Joshua Warner
8abd5cf605
Fix bug in unification of tag args in polymorphic contexts 2022-12-26 13:01:31 -08:00
Ayaz Hafiz
ec0f1ce757
Update mono test name 2022-12-25 16:56:00 -06:00
Ayaz Hafiz
2a64b18c98
Update mono tests 2022-12-25 16:56:00 -06:00
Ayaz Hafiz
a8693e6102
Order list-min-size tests in descending order
Some of the head-constructor tests we generate can be supersets of other tests.
Edges must be ordered so that more general tests always happen after their
specialized variants.

For example, patterns

  [1, ..] -> ...
  [2, 1, ..] -> ...

may generate the edges

  ListLen(>=1) -> <rest>
  ListLen(>=2) -> <rest>

but evaluated in exactly this order, the second edge is never reachable.
The necessary ordering is

  ListLen(>=2) -> <rest>
  ListLen(>=1) -> <rest>

Closes #4732
2022-12-25 16:55:58 -06:00
Joshua Warner
174f7d5e4d
Fix bug in unifying records
This was leading us to have an infinitely-recursive type, which eventually causes layout to stack-overflow

Fixes #4739
2022-12-17 11:37:19 -08:00
Ayaz Hafiz
5606e2d61e
Update test 2022-12-14 17:15:51 -06:00
Ayaz Hafiz
0a071e2a98
Rename mono test 2022-12-14 17:13:58 -06:00
Ayaz Hafiz
b8aa8df100
Make sure to resolve lambda sets for imported top-levels correctly
Part of #4733
2022-12-14 17:13:43 -06:00
Ayaz Hafiz
ed4e047ee8
Reproduce #4733 2022-12-14 17:12:03 -06:00
Ayaz Hafiz
cec6da19de
Check in mono test 2022-12-14 14:20:10 -06:00
Ayaz Hafiz
1233317907
Add test that #4749 compiles
Now that mono does not store expect lookup layouts, the layout cache
should be primed only when specializing the condition of an expect, and
so #4749 is resolved.

Closes #4749
2022-12-14 14:16:59 -06:00
Ayaz Hafiz
897b69b072
Revert "Store layouts in a layout-buffer for expects"
This reverts commit bba6e36a18.
2022-12-14 14:05:46 -06:00
Ayaz Hafiz
bba6e36a18
Store layouts in a layout-buffer for expects 2022-12-14 14:05:28 -06:00
Richard Feldman
da5d0bd815
Merge pull request #4686 from roc-lang/list-range
Switch to more expressive list.range
2022-12-08 02:51:42 -05:00
Ayaz Hafiz
b66813d2db
Check in test for #4705 2022-12-07 10:59:05 -06:00
Ayaz Hafiz
c5dd688e3e
Correct sorting of generated procs for mono test 2022-12-07 10:58:50 -06:00
Ayaz Hafiz
42fe19541e
Define inline expects defs in their definition order
When we transform a top-level expect into an inline expect, we collect
all intermediate defs before the expect condition, then layer the defs
back on. Because the layering procedure builds an expression bottom-up,
we must layer on defs in reverse definition order.

Closes #4705
2022-12-07 10:54:16 -06:00
Ayaz Hafiz
935255d06b
Support compiling programs with test mode in test_mono 2022-12-07 10:48:41 -06:00
Ayaz
8ae8857125
Merge pull request #4696 from roc-lang/hash-nat
add the ability to hash Nats
2022-12-05 20:15:21 -06:00
Brendan Hansknecht
b07e4e8170
fix mono 2022-12-05 16:11:10 -08:00
Ayaz Hafiz
759127660d
Spread list tests can never touch exact-sized bounds tests
When compiling a pattern match like

```
[] -> ..
[_] -> ..
[_, ..] -> ..
```

to a decision tree, we must make sure that the last test (len >= 1)
does not touch the branch reached by the second test (len == 1). It is
enough to ban (len >=) tests from ever touching exact-sized list
patterns, because a spread test (len >=) can never reach an exact-sized
test.

On the other hand, an exact-sized test can reach a spread pattern,
because in

```
[_, _] -> ..
[..] -> ..
```

the last branch generates tests for patterns `[]` and `[_]`, and we would
like those patterns to be covered by the spread test (len >= 0)!

Closes #4685
2022-12-05 13:45:35 -06:00
Ayaz Hafiz
b6a96ebb85
Reproduce miscompilation in #4685 2022-12-05 13:14:32 -06:00
Brendan Hansknecht
415cac5179
update mono tests 2022-12-04 21:49:28 -08:00
Folkert de Vries
c1d3580b0f
Merge pull request #4674 from roc-lang/ircheck
Type-check mono IR
2022-12-04 20:56:54 +01:00
Ayaz Hafiz
d660016b53
Clippy 2022-12-03 23:43:47 -06:00
Ayaz Hafiz
e296d35bcd
Skip testing two mono tests for now 2022-12-03 22:43:19 -06:00
Ayaz Hafiz
01dea13b49
Pretty print symbols 2022-12-03 22:33:45 -06:00
Ayaz Hafiz
7b21936d4f
Add mono checker to tests 2022-12-03 22:10:37 -06:00