Commit graph

346 commits

Author SHA1 Message Date
Ayaz Hafiz
c0969e5ff8
Reuse allocations in fixing closures 2022-08-13 10:38:53 -07:00
Ayaz Hafiz
d19c9107b2
swap_remove rather than removing in place 2022-08-13 10:30:58 -07:00
Ayaz Hafiz
991b99250c
Clippy 2022-08-13 10:25:18 -07:00
Ayaz Hafiz
6bcd682dde
Support captures between mutually recursive closures 2022-08-13 10:25:18 -07:00
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
Folkert
3aa4ebb02f
get expect-fx to actually run 2022-08-12 23:03:01 +02:00
Richard Feldman
97e2900bf5
s/rtfeldman/roc-lang/g in links to GitHub repos 2022-08-12 15:24:09 -04:00
Folkert
7e6a3ddc15
more boilerplate 2022-08-12 13:50:06 +02:00
Folkert de Vries
0798f787c5
Merge pull request #3736 from rtfeldman/i3687
Creation of a record whose type has an optional value is an error
2022-08-11 15:51:41 +02:00
Ayaz Hafiz
b3d4c8f09b
Parse explicit optional field types as rigid optionals 2022-08-10 20:24:19 -07:00
Ayaz Hafiz
fdb79da5a8
Report anonymous functions as "this function" rather than symbol name
Closes #2453

Thanks for the assist @chris-packett
2022-08-10 15:26:52 -07:00
Folkert
7c9b1897bb
fully canonicalize expect-fx 2022-08-09 14:50:24 +02:00
Folkert
bcbc8b4d50
basic canonicalization 2022-08-09 13:59:24 +02:00
Folkert
6bf3e80f51
remove some sendmap usage 2022-08-06 20:00:39 +02:00
Anton-4
6a15a7b41b
changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
Folkert de Vries
5061a67534
Merge pull request #3642 from rtfeldman/can-abilities6
Syntactic abilities: Part 6 - eager lambda set specialization, and fix ability let-generalization
2022-08-01 23:57:56 +02:00
Ayaz Hafiz
b87f09115c
Report opaques as opaques, not aliases
Closes #3313
Closes #3654
2022-08-01 08:02:56 -05:00
Ayaz Hafiz
41eb3ad9a4
Separate ability members and their specializations in reference checking 2022-07-29 08:43:19 -04:00
Ayaz Hafiz
4049eb6780
Remove unused OpportunisticResolve field 2022-07-29 08:43:19 -04:00
Ayaz Hafiz
6b9c1cb690
Check whether opaque implements ability using store 2022-07-26 20:46:35 -04:00
Ayaz Hafiz
28c1a4cb95
Use ImplKey in abilities store public API 2022-07-26 20:46:33 -04:00
Ayaz
6b6f240acb
Merge pull request #3589 from rtfeldman/can-abilities3
Canonicalize syntactic abilities: Part 3 - solving
2022-07-25 21:48:14 -05:00
Folkert de Vries
d212dffa1a
Merge pull request #3616 from rtfeldman/i3614
Compile branches in the presence of degenerate patterns
2022-07-25 19:45:36 +02:00
Ayaz Hafiz
10db3f8574
Detect ability specializations that overload different opaque types 2022-07-25 11:35:20 -04:00
Ayaz Hafiz
51bce825fb
Properly record all erroring ability implementations 2022-07-25 11:30:03 -04:00
Ayaz Hafiz
7167b58e9e
Import declared implementations in correct order 2022-07-25 11:01:46 -04:00
Ayaz Hafiz
75ce40c67d
Make sure ability defs that are possibly recursive are marked as such 2022-07-25 10:52:55 -04:00
Ayaz Hafiz
0525c6d616
Import both specializations and declared ability mappings 2022-07-25 10:06:49 -04:00
Ayaz Hafiz
e2454f497f
Store declared implementations, both custom and derived, in abilities store 2022-07-25 09:09:01 -04:00
Ayaz Hafiz
6035e45f25
Store derivable ability members statically 2022-07-25 09:09:00 -04:00
Richard Feldman
a790db6159
Merge pull request #3613 from rtfeldman/i3263
Allow underscores in assignment patterns, and warn on assignments that don't add anything new
2022-07-25 08:59:40 -04:00
Ayaz Hafiz
0d13dcb1af
Update can tests 2022-07-24 16:11:05 -04:00
Ayaz Hafiz
0de32ac5a9
Warn on definitions that introduce no new variables 2022-07-24 16:11:04 -04:00
Ayaz Hafiz
beccc92c87
Support underscores in assignment patterns 2022-07-24 16:11:03 -04:00
Folkert
29a260a4b3
pass the right region along with inline expects 2022-07-24 11:25:02 +02:00
Ayaz Hafiz
838ba14581
Clippy 2022-07-22 18:16:57 -04:00
Ayaz Hafiz
4031770836
Mark branch patterns degenerate when they don't bind symbols body needs 2022-07-22 17:26:45 -04:00
Richard Feldman
b7d78d9237
Merge pull request #3598 from rtfeldman/i3558
Compile variables bound in multiple patterns of a branch, and detect unbound patterns
2022-07-21 16:45:52 -04:00
Ayaz Hafiz
961cff94d1
Only permit shadowing past first pattern 2022-07-21 14:35:16 -04:00
Richard Feldman
fac29615c8
Merge pull request #3590 from rtfeldman/update-wording
Update wording on a type mismatch
2022-07-21 14:29:23 -04:00
Ayaz Hafiz
0259c3cf92
s/occurences/occurrences/g 2022-07-21 12:29:09 -04:00
Ayaz Hafiz
4839c1f1ce
Clippy doesn't like stack spills. Sorry clippy! 2022-07-21 12:26:42 -04:00
Ayaz Hafiz
78dc82867a
Report errors for identifiers not bound in all patterns of a branch 2022-07-21 12:15:05 -04:00
Ayaz Hafiz
bf8fc0d0de
Permit binding variables multiple itmes in when branches 2022-07-21 11:06:40 -04:00
Folkert
5a93da5a11
some work on expect comment regions 2022-07-21 10:42:57 -04:00
Folkert
7597d11b59
parse the region of the preceding comment for an expect 2022-07-21 10:42:57 -04:00
Folkert
b6f1fd6f40
constrain expects in the right order 2022-07-21 10:42:57 -04:00
Richard Feldman
3972664e48
Rename Category::Float to Category::Frac 2022-07-20 10:49:05 -04:00
Ayaz Hafiz
8f5580c0a5
Clippy 2022-07-19 15:04:01 -04:00
Ayaz Hafiz
cf158d21ed
Fix comment 2022-07-19 14:30:20 -04:00