Commit graph

215 commits

Author SHA1 Message Date
Brian Carroll
ed048c7c93
Fix more tests 2022-11-12 09:12:28 +00:00
Ayaz Hafiz
bd9c9cc184
Replace busted gen test with reporting test 2022-11-11 21:16:26 -06:00
Ayaz Hafiz
ae6f349669
Update reporting test 2022-11-11 21:16:26 -06:00
Ayaz Hafiz
f1180a1549
Byte deletion party 2022-11-11 21:16:23 -06:00
Ayaz Hafiz
a2e90c3709
Fix types SoA usage in solve 2022-11-11 21:16:23 -06:00
Ayaz Hafiz
e3ef9828c7
Store solve aliases as TypeTag 2022-11-11 21:16:05 -06:00
Ayaz Hafiz
314b75b0e5
Feed SoA Types from load into solve 2022-11-11 21:16:03 -06:00
Ayaz Hafiz
4e2eb67ff1
Surface constrain_expr takes an index 2022-11-08 09:00:50 -06:00
Joshua Warner
5d5b71a083
Refactor several parse methods to use more combinators 2022-11-05 09:44:08 -04:00
Richard Feldman
2110540a53
Merge pull request #4464 from joshuawarner32/fix-one_of
Fix one_of bug, properly return MadeProgress from "when" parsing
2022-11-03 19:25:36 -07:00
Joshua Warner
311193fe70
Fix one_of error state handling 2022-11-03 20:54:08 -04:00
Ayaz Hafiz
2a4fca7034
First pass at expectations taking a type index 2022-11-02 15:05:22 -05:00
Ayaz Hafiz
666f0f8a52
Simplify constructor recovery
This fixes a bug in the list pattern matching code that caused crashes
in the presence of list guards, and simplifies the pattern splitting
algorithm to avoid complexity and allocations. Previously we would place
arguments-to-be-matched of constructors and lists at the front of
specialized rows for exhaustiveness checking, but at the back for
redundancy checking. Now, we always place them at the back - this avoids
needless allocation, and is not any worse, since we can still recover
the non-exhaustive witnesses by looking at the end of a list, instead of
the front.
2022-11-01 17:47:22 -05:00
Ayaz Hafiz
1d73560182
Add some more tests 2022-11-01 12:16:11 -05:00
Ayaz Hafiz
342f9f2e02
Add correct redundancy checking and tests for list patterns 2022-11-01 12:07:00 -05:00
Ayaz Hafiz
17920911e4
Implement list exhaustiveness checking 2022-11-01 12:07:00 -05:00
Ayaz Hafiz
08d04e8c79
Update reporting tests 2022-11-01 12:06:59 -05:00
Ayaz Hafiz
fbdf76e490
Report type errors in list pattern matches 2022-11-01 12:06:59 -05:00
Ayaz Hafiz
9ab5d0efb8
Constraining of list patterns 2022-10-31 17:05:08 -05:00
Ayaz Hafiz
7b87d0093e
Update reporting tests 2022-10-31 17:05:08 -05:00
Ayaz Hafiz
058d1f0b5d
Add tests for multiple rest pattern errors 2022-10-31 17:05:07 -05:00
Richard Feldman
bc2ec738a0
Merge pull request #4281 from lucacervello/suggest-lambda-operator
Add suggest lambda operator instead of when
2022-10-31 10:29:46 -07:00
Ayaz Hafiz
debe6332c5
Support OIOP for type aliases 2022-10-31 09:38:21 -05:00
Ayaz Hafiz
6ee2fb496d
Do not check named arguments in both alias args and real typ 2022-10-31 09:38:21 -05:00
Ayaz Hafiz
cfe7c8e5ef
Warn on the presence of unnecessary wildcards in output positions 2022-10-31 09:38:20 -05:00
Ayaz Hafiz
4d48ea7c2f
Materialize extension variable polarity in error type reporting 2022-10-31 09:37:40 -05:00
Ayaz Hafiz
3c15ff4694
Correctly print wildcards as appropriate in error messages 2022-10-31 09:37:39 -05:00
Ayaz Hafiz
89867a4dc5
Add parsing error reporting for list patterns 2022-10-26 18:05:52 -05:00
Ayaz Hafiz
b1a113e084
Simplify confusing error message 2022-10-24 14:00:45 -05:00
Ayaz Hafiz
c1ca64bbc9
Error messages when multiple ability bounds are missing or incomplete 2022-10-24 14:00:45 -05:00
Ayaz Hafiz
603160dae3
Report errors for duplicate bound abilities 2022-10-24 13:59:50 -05:00
Ayaz Hafiz
14e0cd1b84
Address syntax error 2022-10-23 20:49:06 -05:00
Ayaz Hafiz
bb8888b115
Make sure we don't report errors for illegal derived bodies, just their decls 2022-10-23 20:48:05 -05:00
Folkert de Vries
be624f8bcb
Merge pull request #4359 from roc-lang/i4313
Disallow typing optional fields when required fields are annotated
2022-10-23 01:20:55 +02:00
Ayaz Hafiz
05e8e6de6f
Disallow typing optional fields when required fields are annotated
Closes #4313
2022-10-18 15:50:20 -05:00
Luca Cervello
b39f0d98b7
review: use parser suggestion 2022-10-17 18:43:28 +02:00
Ayaz Hafiz
f13c57be8b
Tighten up infinite loop error 2022-10-17 10:02:40 -05:00
Ayaz Hafiz
ecab8fa25a
Make sure self-recursive checks only happen after typechecking
Programs like

```
after : ({} -> a), ({} -> b) -> ({} -> b)

fx = after (\{} -> {}) \{} -> if Bool.true then fx {} else {}
```

are legal because they always decay to functions, even if they may not
look like functions syntactically. Rather than using a syntactic check
to check for illegally-recursive functions, we should only perform such
checks after we know the types of values.

Closes #4291
2022-10-17 09:59:32 -05:00
Ayaz Hafiz
20e4295eea
Make sure type variables bound to abilities are instantiated in aliases
Closes #4259
2022-10-14 13:56:00 -05:00
Ayaz Hafiz
ce2760d96d
Some more reporting tests for Eq 2022-10-12 16:38:36 -05:00
Ayaz Hafiz
99f097ddb5
Improve error messages for abilities 2022-10-12 16:38:35 -05:00
Ayaz Hafiz
b6ffd09adf
Update reporting tests 2022-10-12 16:37:50 -05:00
Ayaz Hafiz
0045c16b3e
Improve notes on underivable abilities 2022-10-12 16:37:49 -05:00
Ayaz Hafiz
b587bcf0c2
Implement obligation checking for the Eq ability
Every type can have `Eq.isEq` derived for it, as long as

- it does not transitively contain a function
- it does not transitively contain a floating point value
- it does not transitively contain an opaque type that does not support
  `Eq`
2022-10-12 16:37:49 -05:00
Luca Cervello
1c0b1ba0af
feat: suggest lambda operator 2022-10-10 12:43:38 +02:00
Ayaz Hafiz
9d91b9bc5a
Add reporting case for inferred char range type mismatch 2022-10-05 17:28:01 -05:00
Ayaz Hafiz
178b634266
Treat single quote literals as ranged numbers for inference purposes 2022-10-05 17:28:00 -05:00
Ayaz
a08b45263b
Merge branch 'main' into shift-signature
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-10-04 12:58:09 -05:00
Ayaz Hafiz
dea7661068
Have Num.shift*By functions shift by a U8
302305020
2022-10-04 12:28:33 -05:00
Ayaz Hafiz
5c6856d1d6
Add reporting test 2022-10-04 11:10:11 -05:00