Commit Graph

5362 Commits

Author SHA1 Message Date
Ayaz Hafiz
906f2349b8
Remove migrated test 2023-03-31 18:02:10 -05:00
Ayaz Hafiz
442812f7c5
Add another test 2023-03-31 18:02:01 -05:00
Ayaz Hafiz
190e436f4f
Move files 2023-03-31 17:58:24 -05:00
Ayaz Hafiz
fadd3e7e4a
Remove migrated test 2023-03-31 14:35:21 -05:00
Ayaz Hafiz
d39a329e28
Update emit header 2023-03-31 14:35:10 -05:00
Ayaz Hafiz
a10ce77584
Support printing can decls in uitest 2023-03-31 14:34:06 -05:00
Ayaz Hafiz
d891dd829f
Migrate more tests 2023-03-31 14:06:49 -05:00
Ayaz Hafiz
834f4afe2c
Add more tests 2023-03-31 13:56:46 -05:00
Ayaz Hafiz
5a9109f17b
Make uitests less noisy 2023-03-31 13:54:38 -05:00
Ayaz Hafiz
3fc54ea578
Migrate a few more tests 2023-03-31 13:45:06 -05:00
Ayaz Hafiz
54d6bf7747
Stub out the rest of uitest 2023-03-31 13:39:33 -05:00
Ayaz Hafiz
3aaf771543
Break up query inference into smaller composable pieces 2023-03-31 13:03:50 -05:00
Ayaz Hafiz
cf3fc7f4a8
Scaffold uitest 2023-03-31 12:47:13 -05:00
Ayaz Hafiz
58cef56a23
Move solve test helpers to their own crate, for now 2023-03-31 11:35:23 -05:00
Ayaz Hafiz
1227d10731
Refactor solve test helpers into a new module 2023-03-31 11:18:24 -05:00
Folkert de Vries
305753b4a7
Merge pull request #5239 from roc-lang/layout-cache-structure-with-multiple-recursive-structures
Record all nested recursive structures an entry in the layout cache contains
2023-03-31 17:54:48 +02:00
Richard Feldman
0bb8c60b93
Merge pull request #5238 from roc-lang/glue-towards-ts
Move RustGlue.roc closer to what we have on the ts branch
2023-03-31 10:11:23 -04:00
Anton-4
d813a1907b
Merge pull request #5214 from roc-lang/md-link-fix
fix pretty crate README link
2023-03-31 13:24:24 +02:00
Ayaz Hafiz
8ca7f91fcd
Clippy 2023-03-30 18:25:31 -05:00
Ayaz Hafiz
4936708b18
Add gen test 2023-03-30 18:20:09 -05:00
Ayaz Hafiz
247913dc20
Record all nested recursive structures an entry in the layout cache contains
If an entry in the layout cache contains recursive structures, the entry
is not reusable if the recursive structure is currently in the "seen"
set. The example elucidated in the source code is as follows:

Suppose we are constructing the layout of

```
[A, B (List r)] as r
```

and we have already constructed and cached the layout of `List r`, which would
be

```
List (Recursive [Unit, List RecursivePointer])
```

If we use the cached entry of `List r`, we would end up with the layout

```
Recursive [Unit, (List (Recursive [Unit, List RecursivePointer]))]
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cached layout for `List r`
```

but this is not correct; the canonical layout of `[A, B (List r)] as r` is

```
Recursive [Unit, (List RecursivePointer)]
```

However, the current implementation only preserves this behavior for
structures that contain one recursive structure under them. In practice,
there can be structures that contain multiple recursive structures under
them, and we must be sure to record all those structures in the
layout-cache.
2023-03-30 18:15:35 -05:00
Ayaz Hafiz
a003451c1f
Add a SmallVec data structure that saves a list on the stack 2023-03-30 18:13:52 -05:00
Folkert
4419e961c8
remove unneeded extern definitions 2023-03-30 21:36:30 +02:00
Folkert
d66ec6d34d
move RustGlue.roc closer to what we have on the ts branch 2023-03-30 21:20:45 +02:00
Folkert
09779f65ad
add NullPointer to mono::ir::Expr 2023-03-30 20:18:04 +02:00
Richard Feldman
dca2d2afd8
Fix Str examples that were using small strings 2023-03-29 21:23:14 -04:00
Richard Feldman
f6f201f1d3
Update mono tests 2023-03-29 21:23:14 -04:00
Richard Feldman
40375a7256
Add some Str.fromUtf8 tests 2023-03-29 21:23:14 -04:00
Richard Feldman
c3c1b8d083
Add Str.walkUtf8 2023-03-29 21:23:13 -04:00
Richard Feldman
f7e96ecf82
Expand some Str docs 2023-03-29 21:23:13 -04:00
Folkert de Vries
7a77702e78
Merge pull request #5190 from roc-lang/pluggable-glue
Pluggable glue
2023-03-29 23:15:57 +02:00
Folkert
99a3c08911
bake roc_alloc and friends into the dynamic library for glue 2023-03-29 19:43:59 +02:00
Folkert
d67617e64b
when roc_panic is setjmp/longjmp, mark its linkage as internal 2023-03-29 15:03:30 +02:00
Brendan Hansknecht
457725e87f
fix end offset of fromUtf8Range 2023-03-28 18:53:47 -07:00
Folkert de Vries
294d32f62b
Merge pull request #5221 from roc-lang/fixes-for-nick
Fix a couple bugs Nick Hallstrom ran into
2023-03-29 01:34:17 +02:00
Folkert de Vries
5374cf21f2
Merge pull request #5205 from roc-lang/i4759
Remove inaccurate debug assertion in IR gen
2023-03-29 01:33:51 +02:00
Ayaz
37d4ff9fdc
Merge pull request #5222 from roc-lang/hash-bool
Implement Hash for Bool
2023-03-28 16:43:44 -05:00
Brendan Hansknecht
2f6f5c09a0
remove old windows specific symbols. Now added by glue 2023-03-28 14:40:50 -07:00
Brendan Hansknecht
6013adcba2
Merge remote-tracking branch 'origin/main' into pluggable-glue 2023-03-28 14:16:00 -07:00
Brendan Hansknecht
f0a7ca8d29
use cfg to avoid pulling unix only data into windows builds 2023-03-28 14:15:53 -07:00
Ayaz Hafiz
2a9e0583bc
Remove inaccurate debug assertion in IR gen
There might be more symbols than field layouts when restructuring a
record if the record is a newtype.

Closes #4759
2023-03-28 15:06:44 -05:00
Ayaz Hafiz
f458da0cbc
Implement Hash for Bool 2023-03-28 15:04:45 -05:00
Ayaz Hafiz
92657b6f4c
Don't intern recursive unions with pointer-fixing if they've been resolved 2023-03-28 14:49:39 -05:00
Ayaz Hafiz
18858b9eb3
Get rid of inaccurate debug assertion 2023-03-28 14:19:43 -05:00
Folkert
c0f49ce62c
correctly add padding between data and tag id 2023-03-28 19:46:26 +02:00
Folkert
fb4a56e916
flip comparison order for better diffs 2023-03-28 19:45:31 +02:00
Ayaz
6de36f29f9
Merge pull request #5207 from roc-lang/tag-union-diffs
Improve tag union diffs
2023-03-27 13:29:44 -05:00
Anton-4
259a3d34ab
Merge pull request #5208 from yukiomoto/add-parentheses-to-nested-function-in-docs
Add missing parentheses of type annotation in docs
2023-03-27 20:21:27 +02:00
Ayaz Hafiz
3f532df981
Generate code for recursive nullable wrapped lambda sets 2023-03-27 10:11:49 -05:00
Ayaz Hafiz
0f73c25c0c
Add gen test for recursion var resolved upon specialization 2023-03-27 10:11:48 -05:00
Ayaz Hafiz
b8a0ff8e7c
Add a mono test for recursive lambda sets with late specialization 2023-03-27 10:11:26 -05:00
Ayaz Hafiz
e06eac9769
Be sure to unify recursion var structure if it hasn't been seen 2023-03-27 10:10:56 -05:00
Ayaz Hafiz
d2b9a1a33c
Improve debug printing for can decls 2023-03-27 10:10:56 -05:00
Anton-4
f55dbcacd1
fix pretty crate README link
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2023-03-27 14:04:34 +02:00
Yuki Omoto
f0e223a6b3
Fix clippy error 2023-03-27 20:43:51 +09:00
Yuki Omoto
1be74346f4
Render parentheses at the right position in docs 2023-03-27 19:49:06 +09:00
Richard Feldman
d391982c33
Apply tag union diffs to recursive tag unions 2023-03-26 23:19:50 -04:00
Richard Feldman
389ec09451
Show ellipses for tag payload slots of same types 2023-03-26 21:43:13 -04:00
Richard Feldman
3013b9e113
Fix reporting edge case where both unions are open 2023-03-26 14:50:27 -04:00
Richard Feldman
21e14589b0
Update tests 2023-03-26 11:49:45 -04:00
Richard Feldman
ae906ca7b3
Improve tag union diffs 2023-03-26 10:01:05 -04:00
Richard Feldman
3ee3c75fb8
Improve Debug formatting for TagName 2023-03-26 10:01:05 -04:00
Yuki Omoto
33ed87cacb
Add missing parentheses of type annotation in docs
This commit adds parentheses for type annotation of nested function
as in `mapWithIndex : List a, (a, Nat -> b) -> List b`.

This resolves #4698
2023-03-26 21:04:26 +09:00
Richard Feldman
e549c8b4a3
Merge pull request #5206 from roc-lang/fix-roc-std-nostd
Only mark roc_std no_std if std feature is not present
2023-03-25 21:59:07 -04: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
Richard Feldman
666339b886
Merge pull request #5196 from yukiomoto/disallow-html-in-docs
Treat html as text in markdown parsing to disallow html in docs
2023-03-25 21:57:18 -04:00
Ayaz
eadbb4eddd
Merge pull request #5202 from roc-lang/i5176
Compilation of when expressions with redundant branches and guards
2023-03-25 20:02:22 -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 Hafiz
782a9839ac
Only mark roc_std no_std if std feature is not present
Otherwise, you will get compile errors with the std feature.
2023-03-25 17:09:38 -05:00
Ayaz Hafiz
5e950134c3
Clippy 2023-03-25 17:06:41 -05:00
Ayaz Hafiz
93dc3714de
Use an iterator to walk over pattern bindings 2023-03-25 17:03:34 -05:00
Ayaz Hafiz
f75248d206
Factor out mono literal and pattern into smaller crates 2023-03-25 16:33:55 -05:00
Ayaz Hafiz
01c15c0648
Use empty slices 2023-03-25 16:15:13 -05:00
Ayaz Hafiz
18ee5d497c
Fix mono tests 2023-03-25 16:15:09 -05:00
Ayaz Hafiz
8a32747bc8
Clippy 2023-03-25 16:14:31 -05:00
Ayaz Hafiz
570876129b
Format 2023-03-25 16:14:31 -05:00
Ayaz Hafiz
628fd6a49f
Add gen test for #5176 2023-03-25 16:14:31 -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
f3ddc254c1
Update comment 2023-03-25 16:14:21 -05:00
Ayaz Hafiz
ecad660e7f
Ensure that when jumping to a branch, all pattern symbols are loaded
If we are jumping to a target branch, it is necessary that the target
branch has all required pattern symbols loaded in it. Usually this is
already the case, but there is an exception with guarded patterns.
Guarded patterns have their patterns loaded only right before the guard
is evaluated, which happens at some point further along the decision
tree. As such, when a guarded pattern jumps to its target destination,
it should append the loaded patterns as parameters on the target
joinpoint.
2023-03-25 16:14:21 -05:00
Ayaz Hafiz
393250db92
Utility to collect symbols bound by a pattern 2023-03-25 16:14:21 -05:00
Ayaz Hafiz
fe9be63787
Utility to substitute many symbols at once 2023-03-25 16:14:20 -05:00
Ayaz Hafiz
c13abb03be
Check in mono test that works now
Closes #4561
2023-03-25 15:58:39 -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
78dea53a46
Merge pull request #5166 from roc-lang/fix-bool-abilities 2023-03-25 15:14:17 -05:00
Ayaz Hafiz
f7455deb06
Get rid of inaccurate debug assertion 2023-03-25 15:01:41 -05:00
Ayaz Hafiz
99d31aa74c
Derive key for decoding should pass under recursion 2023-03-25 15:01:41 -05:00
Ayaz Hafiz
f3d1582a5e
More debugging for missing lambda sets 2023-03-25 15:01:41 -05:00
Ayaz Hafiz
71c76c598a
Derive key for encoding should pass through recursion 2023-03-25 15:01:41 -05:00
Ayaz Hafiz
9b7c4bf367
Debug assertion should be negated 2023-03-25 15:01:40 -05:00
Richard Feldman
5cb2202f6b
Fix typo in comment 2023-03-25 13:28:54 -04:00
Richard Feldman
8f5d18a673
clippy 2023-03-25 13:07:22 -04:00
Richard Feldman
49058c8209
cargo fmt on glue 2023-03-25 11:41:43 -04:00
Yuki Omoto
e8adfa5b71
Treat html as text in markdown parsing to disallow html in docs 2023-03-25 21:17:53 +09:00
Richard Feldman
977b7394f5
Reorder roc glue arguments and add a default 2023-03-24 22:17:54 -04:00
Richard Feldman
0149e7231c
Temporarily disable some glue tests 2023-03-24 20:55:09 -04:00
Richard Feldman
194e74ec38
Fix typo 2023-03-24 20:53:22 -04:00
Ayaz Hafiz
1b2ee9ad30
Make sure openness constraint goes under tuples
Closes #5177
2023-03-24 14:13:14 -05:00
Anton-4
cae7d5eaba
ignore in different order
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2023-03-24 18:00:14 +01:00
Anton-4
c48c8f6d2c
added zig build lock 2023-03-24 17:24:10 +01:00
Ayaz Hafiz
db3698c33c
Fix code guards 2023-03-23 11:53:43 -05:00
Ayaz Hafiz
5069d926bb
Update mono tests 2023-03-23 10:18:04 -05:00
Folkert de Vries
24e2c66187
Merge pull request #5171 from roc-lang/i5169
Fix repl eval of Str.toDec
2023-03-23 09:20:30 +01:00
Ajai Nelson
e6026ec1f9
Allow dead code for ConditionCode 2023-03-23 00:33:55 -04:00
Ajai Nelson
63164b70a0
Move ALL_CONDITIONS to tests module 2023-03-23 00:33:04 -04:00
Ajai Nelson
070033b054
Add jump instructions for aarch64 2023-03-23 00:26:11 -04:00
Ajai Nelson
827b88872e
Format 2023-03-23 00:08:30 -04:00
Ayaz Hafiz
c7f2a1cfe9
Avoid using builtin types in derive tests 2023-03-22 17:08:43 -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
f9f90a3684
Lints 2023-03-22 16:58:12 -05:00
Ayaz Hafiz
1b087df287
Add gen tests for decoding tuples 2023-03-22 16:56:22 -05:00
Ayaz Hafiz
4d3bda51e1
Define naturality of tuple indices 2023-03-22 16:55:23 -05:00
Ayaz Hafiz
cb5a21cb20
Derive decoding for tuples 2023-03-22 16:43:52 -05:00
Brendan Hansknecht
bf41570648
Merge pull request #5153 from roc-lang/morphic-perf
switch morphic to better hashing algorithms
2023-03-22 21:42:21 +00:00
Folkert de Vries
ffaa4a1c1d
Merge pull request #5178 from roc-lang/i5089
Ranged number abilities are derived and compiled correctly
2023-03-22 22:21:18 +01:00
Brendan Hansknecht
87a78407ec
remove accidentally added perf test files 2023-03-22 13:41:41 -07:00
Brendan Hansknecht
72c36129a4
switch to iterators with some cloning to enable reserving HashSet size and avoiding the cost of rehashing 2023-03-22 13:41:40 -07:00
Brendan Hansknecht
9bfe2af259
switch away from drain and instead use into_iter 2023-03-22 13:41:40 -07:00
Brendan Hansknecht
3ef6d9846c
switch morphic to better hashing algorithms 2023-03-22 13:41:40 -07:00
Ayaz Hafiz
e96be7c746
Factor out decoders into separate files 2023-03-22 12:29:21 -05:00
Ayaz Hafiz
5e0a6e5926
Derive key for Decoding tuples 2023-03-22 12:23:16 -05:00
Ayaz Hafiz
92aff265ae
Add doc comment to Decode.record 2023-03-22 12:19:20 -05:00
Ayaz Hafiz
0b3ee77232
Add in Decode.tuple ability member 2023-03-22 12:18:04 -05:00
Ayaz Hafiz
c7bd430026
Gen tests for derived tuple encoding 2023-03-22 11:40:55 -05:00
Ayaz Hafiz
0b4a45c70d
Derive encoding for tuples 2023-03-22 11:37:47 -05:00
Ayaz Hafiz
e5fcb05a2d
Implement derivation keys for tuple encoders 2023-03-22 11:19:47 -05:00
Ayaz Hafiz
a361c4cfc1
Add the tuple ability member to EncoderFormatting 2023-03-22 11:14:46 -05:00
Ayaz Hafiz
8a7d9f8f23
Better debugging when lambda set region is missing 2023-03-22 11:13:00 -05:00
Ayaz Hafiz
72c9b76f23
Gen Eq test for tuple 2023-03-22 10:55:15 -05:00
Ayaz Hafiz
143f39d273
Gen tests for derivation of tuple hash 2023-03-22 10:53:14 -05:00
Ayaz Hafiz
c32bc5f152
Offset tuple element indices correctly when importing 2023-03-22 10:52:31 -05:00
Ayaz Hafiz
8f7b6aaeaa
Implement hash derivation for tuple 2023-03-22 10:28:13 -05:00
Ayaz Hafiz
66fb2f476e
Pretty-print tuple access 2023-03-22 10:27:49 -05:00
Ayaz Hafiz
d9c7010104
Add derive-key tests for derived hash 2023-03-22 10:19:14 -05:00
Ayaz Hafiz
e6cac71ca5
Add support for hash key of tuples 2023-03-22 10:09:57 -05:00
Ayaz Hafiz
f4f9ae7a5d
Implement obligation checking of tuples for all abilities 2023-03-22 10:03:01 -05:00
Ayaz Hafiz
240c1f35d6
Ranged number abilities are derived and compiled correctly
Closes #5089
2023-03-22 09:42:06 -05:00
Ayaz Hafiz
3603183817
Apply opaque pointer recasting to all recursive layouts 2023-03-22 08:21:09 -05:00