Commit graph

99 commits

Author SHA1 Message Date
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
294244ae25
Make sure flex unifies with rigid-able vars correctly 2022-10-04 14:09: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
be853b65c5
Support unification of extension types with uninhabited branches 2022-09-19 10:32:39 -05:00
Ayaz Hafiz
086f7a7e9d
Attempt occurs checks for recursive lambda sets only during monomorphization 2022-08-31 16:45:57 -05:00
Ayaz Hafiz
ea2e5d171a
Invalidate layout-cached variables correctly after merging 2022-08-31 14:17:14 -05:00
Ayaz Hafiz
593d609c2b
Check for unifiability of lambda sets without a subs snapshot
Gives nice performance wins, in particular avoiding clones of
unification tables, which can grow quite large.

Closes #3940
2022-08-31 08:56:45 -05: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
Ayaz Hafiz
81bb889e93
Add RigidOptional record field variant 2022-08-10 20:24:18 -07:00
Ayaz Hafiz
86c6d339c3
Choose merged closure var based on whether it's recursive or not 2022-08-09 16:08:24 -07:00
Anton-4
6a15a7b41b
changed Cargo versions from 0.1.0 to 0.0.1 2022-08-03 11:41:19 +02:00
Folkert de Vries
a00cb58660
Merge pull request #3679 from rtfeldman/i3669
Choose recursion var when merging arbitrary variables, when possible
2022-08-02 22:09:50 +02: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
394a76a7cd
Remove unused arg 2022-08-02 08:15:54 -05:00
Ayaz Hafiz
fc9ff928eb
Choose non-recursion var when merging arbitrary variables, when possible.
Closes #3669
2022-08-02 08:15:54 -05:00
Ayaz Hafiz
a62048f799
Typo 2022-07-29 14:18:47 -04:00
Ayaz Hafiz
1851ee09f8
Add some more comments on the behavior of compaction-mode unification 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
bda52b0d39
Implement unspecialized lambda set unification as list merging 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
1460f60ab1
Unify material recursion variables behind aliases and opaques
Even if there are no changes to alias arguments, and no new variables were
introduced, we may still need to unify the "actual types" of the alias or opaque!

The unification is not necessary from a types perspective (and in fact, we may want
to disable it for `roc check` later on), but it is necessary for the monomorphizer,
which expects identical types to be reflected in the same variable.

As a concrete example, consider the unification of two opaques

  P := [Zero, Succ P]

  (@P (Succ n)) ~ (@P (Succ o))

`P` has no arguments, and unification of the surface of `P` introduces nothing new.
But if we do not unify the types of `n` and `o`, which are recursion variables, they
will remain disjoint! Currently, the implication of this is that they will be seen
to have separate recursive memory layouts in the monomorphizer - which is no good
for our compilation model.

Closes #3653
2022-07-29 11:03:47 -04:00
Ayaz Hafiz
c0e976f544
Wrap unification subs in Env 2022-07-28 08:57:33 -04:00
Ayaz Hafiz
13b0ce7ca0
Make sure to apply "is-open" constraints at the very end of pattern constraining
Closes #3298
2022-07-22 12:57:27 -04:00
Folkert de Vries
ca38ec4eb5
Merge pull request #3541 from rtfeldman/rocasync
Changes to get roc-async working
2022-07-18 19:22:07 +02:00
Ayaz Hafiz
7b23077265
Treat numbers as ad-hoc types for the purpose of checking ability obligations 2022-07-15 10:39:09 -04:00
Ayaz Hafiz
51fd7711e7
Remove dead code 2022-07-14 16:16:30 -04:00
Ayaz Hafiz
6611cce22c
Prefer keeping recursion var when merging tag union payloads 2022-07-14 16:16:30 -04:00
Ayaz Hafiz
1cf1e114be
Derive tag union encoders 2022-07-14 08:49:45 -04:00
Ayaz Hafiz
801803d813
Make sure to union tag outcomes all the way 2022-07-13 08:47:38 -04:00
Ayaz
7b308d9efe
Merge pull request #3404 from rtfeldman/ambient-lset-specialization
The ambient lambda set specialization algorithm
2022-07-09 17:23:27 -05:00
Ayaz Hafiz
d9edb4d1bb
Support unification of recursion vars in opaques 2022-07-08 15:31:29 -04:00
Ayaz Hafiz
ebcd323449
Use strict unification of vars in unspecialized lambda sets right now 2022-07-06 13:08:58 -04:00
Ayaz Hafiz
5d74a376af
Attach ambient function vars to lambda sets 2022-07-06 13:04:29 -04:00
Ayaz Hafiz
26148b8b12
Recover default layouts for floats 2022-07-05 22:16:53 -04:00
Ayaz Hafiz
15afa36344
Push bound var down 2022-07-05 22:16:53 -04:00
Ayaz Hafiz
2492fba9f9
Gen tests for promoted num layouts 2022-07-05 22:16:52 -04:00
Ayaz Hafiz
c154a337a9
Get deep range numbers working 2022-07-05 22:16:52 -04:00
Ayaz Hafiz
1905e1815d
Detect when big number literals cannot fit into the same type 2022-07-05 22:16:49 -04:00
Ayaz Hafiz
806e2f5096
Make sure to properly preserve lambda set ordering 2022-07-03 10:37:27 -04:00
Ayaz Hafiz
eb400590cc
Clippy 2022-07-03 10:37:27 -04:00
Ayaz Hafiz
88618c098d
Unify lambda sets with left/right closure capture differences 2022-07-03 10:37:26 -04:00
Ayaz Hafiz
ca87faa906
Allow union lambdas to have duplicates 2022-07-03 10:37:25 -04:00
Ayaz Hafiz
8fb9ccccfe
Allow captures to be marked as unified without having to be merged
It's very possible to unify two variables without their actual variable
numbers having been merged in the unification forest. We might want to
do that in the future, but it's not necessarily true today. For example
two concrete constructors `{}` and `{}` are unified by their contents,
but the variables are not necessarily merged afterward.
2022-07-03 10:37:25 -04:00
Ayaz Hafiz
cecb6987e7
Admit duplicate lambdas in lambda sets when their captures don't unify 2022-07-03 10:37:25 -04:00
Anton-4
eee85fa45d
moved all crates into seperate folder + related path fixes 2022-07-01 17:37:43 +02:00