Ayaz Hafiz
cfe7c8e5ef
Warn on the presence of unnecessary wildcards in output positions
2022-10-31 09:38:20 -05:00
Ayaz Hafiz
bb1f4cd5e8
Fix bug in closing heuristic
2022-10-31 09:37:40 -05:00
Ayaz Hafiz
7b9ce492c3
Better estimate polarity in exhaustiveness checking
2022-10-31 09:37:40 -05:00
Ayaz Hafiz
69114cc820
Apply a heuristic for opening/closing types before exhaustiveness checking
2022-10-31 09:37:40 -05:00
Ayaz Hafiz
f3623b1e47
Close extension types extended wiht uninhabited types after their extension
2022-10-31 09:37:40 -05:00
Ayaz Hafiz
4d48ea7c2f
Materialize extension variable polarity in error type reporting
2022-10-31 09:37:40 -05:00
Ayaz Hafiz
d77080529a
Introduce polarity for extension variable printing
2022-10-31 09:37:39 -05:00
Folkert de Vries
02a76bb8bd
Merge pull request #4399 from roc-lang/no-types-in-constraining-api
...
Have most constraining APIs take a type index rather than `Type`
2022-10-26 19:45:55 +02:00
Ayaz
316ae7d30b
Merge pull request #4398 from roc-lang/emplace-type-variables
...
Leave variables behind when converting `Type`s to variables
2022-10-26 12:41:55 -05:00
Ayaz Hafiz
a4d7ee33c1
Apply lints
2022-10-24 18:23:36 -05:00
Ayaz Hafiz
97d47cc05f
includes_tag expects type index
2022-10-24 18:08:45 -05:00
Ayaz Hafiz
1f498b52d5
Better name solve test
2022-10-24 14:02:38 -05:00
Ayaz Hafiz
0642952d05
Remove some resolved todos
2022-10-24 14:00:46 -05:00
Ayaz Hafiz
66e75b8660
Simplify instantiation of bound able variables in non-delayed aliases
2022-10-24 14:00:46 -05:00
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
35a4781045
Get rid of redundant references
2022-10-24 13:13:08 -05:00
Ayaz Hafiz
9b24205906
Emplace variables made from types in expectations
2022-10-24 13:11:35 -05:00
Ayaz Hafiz
04a3f1c00e
Use a helper to emplace type cells
2022-10-24 12:07:00 -05:00
Ayaz Hafiz
d3e14550d8
Leave variables behind when converting Type
s to variables
...
This is part one of addressing the present issues with emplacing type
directly where type variables should be reused. Now, when an
`Index<Type>` is converted to a variable in solving, we leave the
converted variable in the `Type`'s place. Specifically, we keep an index
to a `Cell<Type>`.
Note that this transformation is only temporary, it will be removed once
we merge this with the `Type` SoA representation, but it is needed in
the meantime as I transform the `Constrain` API to get rid of
type-emplacement.
2022-10-24 11:42:35 -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