Ayaz Hafiz
05d8bca0fb
Move DeriveBuiltin to derive_key
2022-08-02 14:29:49 -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
Folkert de Vries
5061a67534
Merge pull request #3642 from rtfeldman/can-abilities6
...
Syntactic abilities: Part 6 - eager lambda set specialization, and fix ability let-generalization
2022-08-01 23:57:56 +02:00
Ayaz Hafiz
b8328c2b5b
Remove stray dbgs
2022-08-01 09:09:37 -05:00
Ayaz Hafiz
2adde2351f
Add subs to member_parent_and_signature_var
2022-08-01 09:05:16 -05:00
Ayaz Hafiz
b72c8705e5
Add an AbilityResolver trait for abilities stores and views
2022-08-01 08:09:24 -05:00
Ayaz Hafiz
02d5d0ec92
Allow naming type variables with a basis hint
...
I think this makes it easier to read type variables when they come from
flex/rigid vars with pre-existing names, just give them a number suffix
to differentiate them.
2022-07-29 15:32:44 -04:00
Ayaz Hafiz
4657a957f7
When storing variables, merge them directly with the target rather than unifying
...
When we unify two variables that end up merged, the rank of the
resulting content is the lower of the two variables being merged. But
during storage, we really do mean, take the target descriptor of the
type we're merging against, and don't try to lower to a
possibly-generalized rank! This fixes a couple bugs I didn't even
realize were present!
2022-07-29 14:53:14 -04:00
Ayaz Hafiz
3b38228c36
Fix infer query indentation
2022-07-29 14:18:47 -04:00
Ayaz Hafiz
ff4b5f58ab
Avoid over-eager disjoint variable merging during lambda set compaction
...
During the unspecialized lambda set compaction procedure, we might end
up trying to merge too many disjoint variables during unspecialized
lambda unification. Avoid doing so, by checking if we're in the
compaction procedure.
2022-07-29 14:18:47 -04:00
Ayaz Hafiz
7926499900
Implement disjoint type variable handling in the lambda set specialization algorithm
...
This completes the last known hole I am aware of in the current
lambda set specialization algorithm.
Closes #3421
2022-07-29 14:18:46 -04:00
Ayaz Hafiz
1976e435a0
Turn a couple more solve tests back on
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
41eb3ad9a4
Separate ability members and their specializations in reference checking
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
7a4c57d3dc
Clippy
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
4049eb6780
Remove unused OpportunisticResolve field
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
31220d5598
Fix spelling
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
f145f29b1b
Make sure records don't de-generalize function types, fixing ability let-generalization
...
Closes #3641
2022-07-29 08:43:19 -04:00
Ayaz Hafiz
ce8c8f7264
Update solve test
...
Use named recursive calls for now in ability members
2022-07-29 08:43:18 -04:00
Ayaz Hafiz
f2d4bf20ba
Collect awaited lambda set specializations to be solved when a specialization is known
...
Despite our best efforts, sometimes we still can't specialize lambda
sets on the fly, if a specialization lambda set's specialization type
isn't yet well-known! This commit adds an `AwaitingSpecializations`
data structure to keep track of the lambda sets blocked for
specialization behind a specialization's full resolution in the module.
After the specialization is resolved, its blocked lambda sets can be
eagerly compacted.
2022-07-29 08:43:18 -04:00
Ayaz Hafiz
350d9cd59b
Simplify opportunistic resolution
...
We don't need to unify the type state anymore because resolved able
variables are determined only by one type variable.
2022-07-29 08:43:18 -04:00
Ayaz Hafiz
5a42acc11c
Debug specialization keys
2022-07-29 08:43:18 -04:00
Ayaz Hafiz
240a48bc1c
De-duplicate unspecialized lambda sets by root var
2022-07-29 08:43:17 -04:00
Ayaz Hafiz
76fe397aa1
Consolidate exposed types and derived module in a derived environment
2022-07-29 08:43:17 -04:00
Ayaz Hafiz
0ec92c12f7
Move lambda set specialization to its own module in solve
2022-07-29 08:43:16 -04:00
Ayaz Hafiz
c0e976f544
Wrap unification subs in Env
2022-07-28 08:57:33 -04:00
Ayaz Hafiz
0989b2cb82
Move solve problems to their own crate
2022-07-28 08:57:32 -04:00
Ayaz Hafiz
ae4916ceb7
Remove unused variables
2022-07-28 08:57:14 -04:00
Ayaz Hafiz
753d12e912
Eagerly resolve obligations during solving
...
Replaces the previously-used `DeferredObligations` structure used for
accumulating and then acting over ability obligations during module
solving in favor of just the `ObligationCache`. The `ObligationCache`
stays alive for the entirety of a module solving and provides a
convenient mechanism for answering obligation queries with a backed
cache.
2022-07-28 08:57:13 -04:00
Ayaz Hafiz
bb14b649a2
Don't re-report obligations that we know were seen elsewhere
2022-07-26 20:46:35 -04:00
Ayaz Hafiz
6b9c1cb690
Check whether opaque implements ability using store
2022-07-26 20:46:35 -04:00
Ayaz Hafiz
8659ddc684
Remove dominated derive errors
2022-07-26 20:46:35 -04:00
Ayaz Hafiz
3fbf4e228b
Remove dominated derives from obligation checking
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
ad3eb959e9
Don't mark dominated derives anymore
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
04ee74542d
Rename IncompleteAbility
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
c0d26226dd
Remove deferred obligation for opaques during solving
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
c1dbffdad9
Make sure wrong specializations become error types
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
3703940da9
Report specializations that target the unexpected type
2022-07-26 20:46:34 -04:00
Ayaz Hafiz
968bd468a8
Use proper members in checking derive keys
2022-07-26 20:46:33 -04:00
Ayaz Hafiz
f2cf7405df
Revert "Use abilities ImplKey in solve"
...
This reverts commit b7cb0003134f1b0c657d7173db6965b4247500aa.
2022-07-26 20:46:33 -04:00
Ayaz Hafiz
254d684dfa
Use abilities ImplKey in solve
2022-07-26 20:46:33 -04:00
Ayaz Hafiz
28c1a4cb95
Use ImplKey in abilities store public API
2022-07-26 20:46:33 -04:00
Ayaz Hafiz
51bce825fb
Properly record all erroring ability implementations
2022-07-25 11:30:03 -04:00
Ayaz Hafiz
9a60f720d4
Add reproduction for recursive ability impl specialization with inference
2022-07-25 10:53:29 -04:00
Ayaz Hafiz
75ce40c67d
Make sure ability defs that are possibly recursive are marked as such
2022-07-25 10:52:55 -04:00
Ayaz Hafiz
0525c6d616
Import both specializations and declared ability mappings
2022-07-25 10:06:49 -04:00
Ayaz Hafiz
cd0b8577ab
Have load_internal deal with separate declared/known ability specializations
2022-07-25 09:24:58 -04:00
Ayaz Hafiz
e2454f497f
Store declared implementations, both custom and derived, in abilities store
2022-07-25 09:09:01 -04:00
Ayaz Hafiz
6035e45f25
Store derivable ability members statically
2022-07-25 09:09:00 -04:00
Ayaz Hafiz
c882c76685
Update test
2022-07-24 16:12:47 -04:00