Commit graph

372 commits

Author SHA1 Message Date
Ayaz Hafiz
f458da0cbc
Implement Hash for Bool 2023-03-28 15:04:45 -05:00
Ayaz Hafiz
d2b9a1a33c
Improve debug printing for can decls 2023-03-27 10:10:56 -05:00
Ayaz
8c55e8126d
Merge pull request #5203 from roc-lang/virtual-dom-annotations
Fix a few bugs Virtual-DOM cropped up
2023-03-25 20:00:51 -05:00
Ayaz
1891df77b8
Merge pull request #5188 from roc-lang/i5177
Make sure openness constraint goes under tuples
2023-03-25 15:52:09 -05:00
Ayaz
61dd5cc8c7
Merge pull request #5179 from roc-lang/i5143-tuple-abilities
Implement ability obligation checking and derivation for tuples
2023-03-25 15:51:39 -05:00
Ayaz Hafiz
f37ede036a
Do not adjust rank of lambda sets under alias arguments 2023-03-25 15:21:40 -05:00
Ayaz Hafiz
1b2ee9ad30
Make sure openness constraint goes under tuples
Closes #5177
2023-03-24 14:13:14 -05:00
Ayaz Hafiz
84fa22f235
Fix solve test module 2023-03-22 17:08:43 -05:00
Ayaz Hafiz
3e83e42195
Make sure to report error rather than descending as appropriate 2023-03-22 17:08:43 -05:00
Ayaz Hafiz
3d2642b282
Stray dbg 2023-03-22 17:08:42 -05:00
Ayaz Hafiz
e6094df69b
Fast-path for determining ability member impls for builtin opaques 2023-03-22 17:08:41 -05:00
Ayaz Hafiz
297a571b34
Eq for Bool 2023-03-22 17:03:58 -05:00
Ayaz Hafiz
5be8ff700d
Derive encode for bool 2023-03-22 17:03:58 -05:00
Ayaz Hafiz
9563b444cd
Fix test 2023-03-22 17:03:57 -05:00
Ayaz Hafiz
075332ec88
Run builtin opaques and abilities through derive key 2023-03-22 17:03:57 -05:00
Ayaz Hafiz
f079e8c96b
Bool derive key for Decode 2023-03-22 17:03:57 -05:00
Ayaz Hafiz
dba72c0565
Handle builtin opaque types that implement an ability but don't explicitly list so 2023-03-22 17:03:35 -05:00
Ayaz Hafiz
8a7d9f8f23
Better debugging when lambda set region is missing 2023-03-22 11:13:00 -05:00
Ayaz Hafiz
f4f9ae7a5d
Implement obligation checking of tuples for all abilities 2023-03-22 10:03:01 -05: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
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
b406e384fc
Print recursion variables correctly in pretty printer 2023-02-13 17:42:21 -06:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Ayaz Hafiz
63e30443fd
Fix formatting 2023-01-27 17:35:31 -06:00
Ayaz Hafiz
572a666780
No Encode/Decode for Nat 2023-01-27 17:16:10 -06:00
Joshua Warner
303e5bceb3
Fix tuple accessor type printing 2023-01-22 13:22:39 -08:00
Joshua Warner
de828416bf
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
2023-01-22 12:40:44 -08:00
Ayaz
ed7123ed5b
Merge pull request #4887 from roc-lang/weakening-5
Finish weakening let-bindings
2023-01-17 12:47:12 -06:00
Ayaz Hafiz
c9460ecf3f
Rename IsImplicitOpennessVar 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
5fceb9ceb7
Push implicit openness vars through 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
a47841d426
Generalize tag openness extension variables 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
1c93727822
Add a notion of "openness" tag extensions suitable only for size-polymorphism 2023-01-16 10:52:23 -06:00
Ayaz Hafiz
c3f1646274
Weaken ability members behind let-bindings 2023-01-16 10:49:17 -06:00
Ayaz Hafiz
48049ed956
Weaken tags behind let bindings 2023-01-16 10:49:17 -06:00
Ayaz Hafiz
52c2f3a054
Weaken zero-argument tags in let bindings 2023-01-16 10:49:16 -06:00
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
d27a72de1f
Weaken let sequences under let binding 2023-01-14 15:33:49 +01:00
Folkert de Vries
e3a213c0dc
Merge pull request #4882 from roc-lang/weakening-3
Begin weakening let-bindings to non-function, non-number expressions
2023-01-14 15:32:27 +01:00
Ayaz Hafiz
7c4cfba4b8
Rephrase solve comments as per Folkert's review 2023-01-13 12:58:11 -06:00
Ayaz Hafiz
9462f44bb7
Weaken variables bound to when expressions 2023-01-12 10:02:21 -06:00
Ayaz Hafiz
b2cdddbdfb
Weaken lists 2023-01-12 10:02:20 -06:00
Folkert de Vries
386983a657
Merge pull request #4881 from roc-lang/rename-rank-none
Rename rank none to rank generalized
2023-01-12 00:25:24 +01:00
Ayaz Hafiz
d214598a16
Rename rank none to rank generalized 2023-01-11 14:55:18 -06:00
Ayaz Hafiz
058644aa96
Implement weakening of variables introduced in branch patterns
Variables introduced in branch patterns should never be generalized in
the new weakening model. This implements that. The strategy is:

- when we have a let-binding that should be weakened, do not introduce
  its bound variables in a new (higher) rank
- instead, introduce them at the current rank, and also solve the
  let-binding at the current rank
- if any of those variables should then be generalized relative to the
  current rank, they will be so when the current rank is popped and
  generalized
2023-01-11 14:28:46 -06:00
Ayaz Hafiz
7febddd1ea
Get rid of unneeded unsafe code and explain max_rank adjustment 2023-01-11 14:28:46 -06:00
Ayaz Hafiz
ddda00036e
Add more comments to solve 2023-01-11 14:28:46 -06:00
Ayaz Hafiz
c2cb94a927
Decide rank to work in for weakening 2023-01-11 14:28:46 -06:00