Ayaz Hafiz
3f5a86ded3
Update ability bindings
2022-10-24 14:00:46 -05:00
Ayaz Hafiz
0da72df5e9
Add ability slice to eq obligation checker
2022-10-24 14:00:46 -05:00
Ayaz Hafiz
3bd10698cf
Allow rigid able to unify with flex able when rigid bounds are a superset
2022-10-24 14:00:45 -05:00
Ayaz Hafiz
0a96a93a67
Add test for inferring multiple ability bounds
2022-10-24 14:00:44 -05:00
Ayaz Hafiz
9c88534758
Obligation checking layers on extra abilities bound to a variable
2022-10-24 13:59:52 -05:00
Ayaz Hafiz
1e6181d2cb
New data structure for storing sorted abilities bound to a variable
2022-10-24 13:59:51 -05:00
Ayaz Hafiz
229548571b
Represent "able" variables with slices of abilities
2022-10-24 13:59:51 -05:00
Ayaz Hafiz
0f0678ce73
s/closure_names/symbol_names/g in subs
2022-10-24 13:59:51 -05:00
Ayaz Hafiz
6bb97c92b9
Canonicalize multiple abilities bound to a type variable
2022-10-24 13:56:07 -05:00
Ayaz Hafiz
e75f3c3c79
Get rid of MemberImpl::Derived
...
We don't need this anymore, since derived members become Impls during
canonicalization now!
2022-10-23 20:48:07 -05:00
Ayaz Hafiz
1d885c4ab2
Support deriving Decode for opaques
2022-10-23 20:48:06 -05:00
Ayaz Hafiz
c4f9aa6fe6
Add deriving toEncoder for opaques
2022-10-23 20:47:42 -05:00
Ayaz Hafiz
83813afeaf
Derive Eq for opaques
2022-10-23 20:46:56 -05:00
Ayaz Hafiz
40e05d5a00
Add support for deriving Hash for opaques
2022-10-23 20:46:56 -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
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
5e35b6458a
Apply lint suggestions
2022-10-14 13:56:01 -05:00
Ayaz Hafiz
65f1bd2907
Fix rigid able bindings to abilities
2022-10-14 13:56:01 -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
6149c289fc
Update Eq symbols
2022-10-12 16:38:36 -05:00
Ayaz Hafiz
a256947a9f
Move Eq to Bool
2022-10-12 16:37:51 -05:00
Ayaz Hafiz
12778762b2
Make sure Box
is handled as an Apply
type
2022-10-12 16:37:50 -05:00
Ayaz Hafiz
1c753ae031
Update solve tests
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
Ayaz Hafiz
16d12a51c2
Add Eq
to the standard library
2022-10-12 16:37:48 -05:00
Ayaz
83b64c4fb3
Merge pull request #4209 from roc-lang/impl-tag-discriminant
...
Derive `Hash` implementations for tag unions
2022-10-10 22:23:05 -05:00
Richard Feldman
3d5728d82c
Merge pull request #4257 from roc-lang/i4246
...
Correctly check mutual functional recursion between opaque types
2022-10-08 16:20:27 -07:00
Ayaz
51c687df54
Merge branch 'main' into i4150
...
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2022-10-08 16:08:35 -05:00
Ayaz Hafiz
d9863cbbaa
Correctly check mutual functional recursion between opaque types
...
The mutual-recursion checks does not admit types that are not function
types; because Roc is strict, only functional values can be involved in
mutual recursion. However, this check was exercised by checking the head
constructor of a type, which is not the correct way to do it. Aliases
and opaque types may in fact be function types as well, so we must chase
their actual contents.
Closes #4246
2022-10-08 10:09:55 -05:00
Ayaz Hafiz
912cebc33d
Add tests for inferring char ranged number
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 Hafiz
06e5110aa5
Unification of multiple tag-functions
2022-10-05 17:25:11 -05:00
Ayaz Hafiz
61cf8e53e6
Have FunctionOrTagUnion include multiple possible tags
2022-10-05 17:24:52 -05:00
Ayaz Hafiz
2517695ce4
Fix deriving of hash ability for recursive tag unions
2022-10-05 12:01:02 -05:00
Ayaz Hafiz
5b833e57b5
Support derivation of Hash for Str and List
2022-10-04 14:09:40 -05:00
Ayaz Hafiz
f68cb3b0ed
Flip order of hash
signature
2022-10-04 12:14:07 -05:00
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
dependabot[bot]
49dd5af13d
Bump insta from 1.19.0 to 1.20.0
...
Bumps [insta](https://github.com/mitsuhiko/insta ) from 1.19.0 to 1.20.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.19.0...1.20.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-09-26 07:14:24 +00:00
Ayaz Hafiz
06bef34829
Import Decode by default in all modules
2022-09-21 12:29:07 -05:00
Ayaz Hafiz
b7b0af0d45
Update solve tests
2022-09-21 12:29:06 -05:00
Ayaz Hafiz
454f3634fd
Import all types from Encode by default
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
Folkert de Vries
cc202a4cf9
Merge pull request #4082 from roc-lang/update-cli-platform-unreachables
...
Support unification with uninhabited tag variants in more places
2022-09-21 12:18:38 +02:00
kilianv
9717747a54
Update tests
...
not all tests pass yet. Will look at them with Ayaz.
2022-09-20 14:42:03 -05:00
Ayaz Hafiz
412c73c54c
Add test cases for uninhabited variant collapsing with destructure patterns
...
Closes #4080
2022-09-20 14:22:40 -05:00
Ayaz Hafiz
f96c825aa4
Allow uninhabited type extension to happen on either unification side
2022-09-20 14:20:47 -05:00
Ayaz Hafiz
b0598ef817
Simplify unification with uninhabited tags to happen anytime tags are uninhabited
...
I believe this is safe! No need to gate it behind a mode.
2022-09-20 14:13:55 -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