Ayaz Hafiz
e9efc95425
Obligation checking for the Hash
ability
...
This implements type-level checks that types can and cannot implement
the `Hash` ability.
Part of #4195
2022-10-04 10:51:14 -05:00
Ayaz Hafiz
eadbc0912a
Update the compiler to be aware of Hash
2022-10-04 10:22:22 -05:00
Ayaz Hafiz
cf5712620c
Suggest Bool.true and Bool.false where tag literals are used
...
Closes #4147
2022-10-03 17:36:27 -05:00
Ayaz Hafiz
581eeb5054
Improve invalid recursion error message quality
2022-10-03 13:30:43 -05:00
Ayaz Hafiz
92b754f292
Illegal self recursion on toplevel defs
...
Closes #4153
2022-10-03 13:14:56 -05:00
Ayaz Hafiz
fd4b20de58
Fix test
...
Closes #3385
2022-10-03 13:03:52 -05:00
Ayaz Hafiz
985da70343
Add tests to ignore for now
2022-09-30 13:40:34 -05:00
Ayaz Hafiz
92aa0912ea
Report unused imports in modules
2022-09-30 13:40:34 -05:00
Ayaz Hafiz
5dc51ce444
Add unnecessary import test cases
2022-09-30 13:40:34 -05:00
Ayaz Hafiz
5f117be306
Improve error message when shadowing builtin type
...
Closes #3109
2022-09-30 13:40:34 -05:00
Tim Whiting
ab000a5b49
Update error text
...
fix error text
2022-09-30 07:36:24 -06:00
Tim Whiting
f323fe6534
fix expression indentation error
2022-09-28 20:11:24 -06:00
Ayaz Hafiz
06bef34829
Import Decode by default in all modules
2022-09-21 12:29:07 -05:00
Ayaz Hafiz
1de37f042e
Update reporting tests
2022-09-21 12:29:06 -05:00
Ayaz
211c297230
Merge pull request #4041 from KilianVounckx/opaque-bool
...
Opaque bool
2022-09-21 11:15:41 -05:00
Ayaz Hafiz
c430939432
Fix reporting tests
2022-09-20 15:51:04 -05:00
Ayaz Hafiz
3d4313efbf
Update reporting tests
2022-09-20 14:42:09 -05:00
Ayaz Hafiz
1799d6ed0e
Construct exhaustiveness branches with condition, not branch, variable
...
Previously we would construct the shapes of unions used in the pattern
tree for exhaustiveness checking using the type of the branch patterns,
rather than the type of the condition variable. Clearly we want to
always use the condition variable, otherwise some branches will be
seen as exhaustive, when they are not!
To do this, we now index into the condition variable while refying the
patterns to build the tree for exhaustiveness checking.
Closes #4068
2022-09-19 13:37:59 -05:00
Ayaz Hafiz
0f0e414272
Improve error message for uninhabited patterns
2022-09-19 10:55:02 -05:00
Ayaz Hafiz
147636f42b
Base reported row numbers on original rows, not reified rows
2022-09-19 10:47:35 -05:00
Ayaz Hafiz
041b91e031
Add more test cases
2022-09-19 10:45:31 -05:00
Ayaz Hafiz
6adb88beee
Report uninhabited branches as redundant
2022-09-16 15:55:46 -05:00
Ayaz Hafiz
1d7aef8c96
Don't include uninhabited constructors in exhaustiveness checking
2022-09-16 15:36:54 -05:00
Ayaz Hafiz
42633c1f96
Span body of last branch in exhaustiveness checking
...
Closes #4028
2022-09-13 16:24:59 -04:00
Ayaz Hafiz
c2452ff751
Lose rigidity of annotated optional fields before generalization
...
We have this idea of "rigid optional" fields to annotate record fields
that must necessarily be optional. That avoids the admission of programs
we cannot faithfully compile, like
```
f : {a: Str, b ? U64}
f = {a: "b", b: 1}
```
We want to lose the rigidity restriction when a generalized symbol is
used as at a specialized site; for example it should be possible to call
`f : {x ? Str} -> {}` with both `{}` and `{x : Str}`, neither of which
have a rigidly optional field unless they were to be annotated.
Prior to this commit we would loosen the rigidity restriction upon
specialization of a generalized type at a use site. However, what we
really want to do is apply the loosening during calculation of
generalization. The reason is that otherwise, we must make types that
would be ground (like `{x ? Str} -> {}`) generalized just for the sake
of the optional field annotation. But since the rigidity constraint is
irrelevant after an annotated body has been checked, we can loosen the
rigidity restriction then, which conveniently happens to coincide with
the generalization calculation.
Closes #3955
2022-09-06 17:44:04 -05:00
Ayaz Hafiz
92ce0c0662
Fix opaque typo
2022-08-23 10:39:51 -05:00
Ayaz Hafiz
cfc46c05ae
Turn on reporting test that works now
2022-08-23 10:39:51 -05:00
Ayaz Hafiz
d2b9cc056f
Record with optionally-typed fields cannot be derived for decoding
2022-08-23 10:38:30 -05:00
Ayaz Hafiz
958f64c8fc
Turn on reporting test for underivable record
2022-08-23 10:38:02 -05:00
Ayaz Hafiz
4ba132f7d0
Make sure inferring decode into nested function type is an error
2022-08-22 17:06:22 -05:00
Ayaz Hafiz
b30c90b500
Don't suggest removing variable when it's bound in a branch pattern
...
Instead, suggest prefixing it with an underscore, or replacing with an
underscore.
Closes #3820
2022-08-19 22:21:44 -05:00
Richard Feldman
97e2900bf5
s/rtfeldman/roc-lang/g in links to GitHub repos
2022-08-12 15:24:09 -04: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
Folkert
5b10ebeeb7
Merge remote-tracking branch 'origin/trunk' into i2453
2022-08-11 10:44:26 +02:00
Folkert de Vries
ae0e90c8f3
Merge pull request #3738 from rtfeldman/i3444
...
Layout generation for recursive lambda sets
2022-08-11 10:22:07 +02:00
Ayaz Hafiz
6dc16521d3
Add illegal case of conditionally creating optional field
...
Closes #3687
2022-08-10 20:24:20 -07:00
Ayaz Hafiz
0bfbeed843
Use Str instead of U64
2022-08-10 20:24:20 -07:00
Ayaz Hafiz
8ccbceaa48
Update reporting tests
2022-08-10 20:24:20 -07:00
Ayaz Hafiz
81bb889e93
Add RigidOptional record field variant
2022-08-10 20:24:18 -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
Ayaz Hafiz
5ebb85481c
Update reporting tests
2022-08-09 17:23:27 -07:00
Ayaz Hafiz
d22bd274fd
Check for infinite types of introduced variables before bodies
2022-08-09 14:09:51 -07:00
Ayaz Hafiz
d2015d51f2
Print all argument in tags when their argument lengths mismatch
...
Closes #3553
2022-08-09 12:46:53 -07:00
Ayaz Hafiz
8c87ae50c9
Wrap applied types in parens as appropriate
2022-08-09 12:31:01 -07:00
Ayaz Hafiz
3db07a5697
Reproduce #3553
2022-08-09 12:22:31 -07:00
Richard Feldman
e685eba42b
fix tests
2022-08-03 19:50:17 -04:00
Ayaz Hafiz
5d1198ae1f
Add more underivable decoding tests
2022-08-02 14:31:17 -05:00
Ayaz Hafiz
4bbc6b74fc
Add derivability obligation checking for Decode
2022-08-02 14:31:16 -05:00
Ayaz
fa14146054
Merge pull request #3531 from rtfeldman/decode
...
Very basic Decode.roc in the standard library
2022-08-02 14:26:28 -05:00
Folkert de Vries
86a1a0f401
Merge pull request #3643 from rtfeldman/disjoint-able-variable-specialization
...
Disjoint able variable specialization algorithm
2022-08-02 20:31:47 +02:00