Commit Graph

23963 Commits

Author SHA1 Message Date
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
Ayaz
39b637c4f7
Merge pull request #5210 from roc-lang/expect-tag-padding
expect tag padding
2023-03-28 15:09:43 -05: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
Richard Feldman
830a01f1f7
Merge pull request #5211 from dankeyy/patch-1
update roc-for-elm-programmers doc on tuples
2023-03-27 14:09:03 -04:00
Folkert de Vries
53851f5738
Merge pull request #5215 from roc-lang/fix-non-nullable-unwrapped-recursive-lset
Fix compilation problems with recursive lambda sets
2023-03-27 20:00:16 +02:00
Anton-4
137ea27f93
small README improvement 2023-03-27 19:27:06 +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
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
dankeyy
2dc777073a
fix tuples section
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
Signed-off-by: dankeyy <dankeyy@protonmail.com>
2023-03-27 12:08:02 +03: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
dankeyy
22ab9053d8
roc now has tuples
Signed-off-by: dankeyy <dankeyy@protonmail.com>
2023-03-26 20:04:18 +03: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