Commit Graph

132 Commits

Author SHA1 Message Date
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
ac752adc7c
Check in some more work 2022-09-16 16:09:21 -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
dependabot[bot]
0079048944
Bump bumpalo from 3.10.0 to 3.11.0
Bumps [bumpalo](https://github.com/fitzgen/bumpalo) from 3.10.0 to 3.11.0.
- [Release notes](https://github.com/fitzgen/bumpalo/releases)
- [Changelog](https://github.com/fitzgen/bumpalo/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fitzgen/bumpalo/compare/3.10.0...3.11.0)

---
updated-dependencies:
- dependency-name: bumpalo
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 21:08:56 +00:00
dependabot[bot]
d1c406812f
Bump pretty_assertions from 1.2.1 to 1.3.0
Bumps [pretty_assertions](https://github.com/rust-pretty-assertions/rust-pretty-assertions) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/rust-pretty-assertions/rust-pretty-assertions/releases)
- [Changelog](https://github.com/rust-pretty-assertions/rust-pretty-assertions/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-pretty-assertions/rust-pretty-assertions/compare/v1.2.1...v1.3.0)

---
updated-dependencies:
- dependency-name: pretty_assertions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 05:28:00 +00:00
Jan Van Bruggen
431455dd1b
Rephrase web/terminal-related "platform" to "environment" 2022-09-11 10:25:02 -06: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
Folkert de Vries
3dbf6cc99b
Merge pull request #3859 from roc-lang/dependabot/cargo/insta-1.19.0
Bump insta from 1.18.2 to 1.19.0
2022-08-30 12:14:24 +02:00
Ayaz Hafiz
d016d5eeb9
Refine message 2022-08-23 10:39:51 -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
e77e53f37b
Enable optional record field underivable error 2022-08-23 10:39:51 -05:00
Ayaz Hafiz
55fe1df995
Add more context to derivability errors when they happen 2022-08-23 10:39:50 -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
dependabot[bot]
0f31f0f07a
Bump insta from 1.18.2 to 1.19.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.18.2 to 1.19.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.18.2...1.19.0)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 05:22:53 +00: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
dependabot[bot]
4c6ad52c47
Bump indoc from 1.0.6 to 1.0.7
Bumps [indoc](https://github.com/dtolnay/indoc) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/1.0.6...1.0.7)

---
updated-dependencies:
- dependency-name: indoc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-15 13:18:18 +00:00
dependabot[bot]
7ab742dd1a
Bump insta from 1.15.0 to 1.18.2
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.15.0 to 1.18.2.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.15.0...1.18.2)

---
updated-dependencies:
- dependency-name: insta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-13 16:49:28 +00: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
af19df1a0a
Include optional/required mismatch for rigid optionals 2022-08-10 20:24:19 -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
26ee1a01bc
Merge pull request #3691 from rtfeldman/cargo_verson_change
changed Cargo versions from 0.1.0 to 0.0.1
2022-08-05 09:13:04 -04:00
Richard Feldman
e685eba42b
fix tests 2022-08-03 19:50:17 -04:00
Anton-4
6a15a7b41b
changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
Ayaz Hafiz
5d1198ae1f
Add more underivable decoding tests 2022-08-02 14:31:17 -05:00
Ayaz Hafiz
36969f0720
Print all derivable abilities 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
Ayaz Hafiz
e2f1417224
Update reporting test 2022-08-01 11:40:16 -05:00
Ayaz Hafiz
b87f09115c
Report opaques as opaques, not aliases
Closes #3313
Closes #3654
2022-08-01 08:02:56 -05:00