Commit graph

145 commits

Author SHA1 Message Date
Ayaz
ee3c71dfe6
Merge branch 'main' into ayaz/error-on-invalid-generalized-types
Signed-off-by: Ayaz <20735482+ayazhafiz@users.noreply.github.com>
2025-01-10 14:36:48 -05:00
Sam Mohr
30b8a1407d
Fix broken ability implementation 2025-01-04 05:37:17 -08:00
Ayaz Hafiz
a0461679dd Restrict usages of type variables in non-generalized contexts
Type variables can only be used on functions (and in number literals as
a carve-out for now). In all other cases, a type variable takes on a
single, concrete type based on later usages. This check emits errors
when this is violated.

The implementation is to check the rank of a variable after it could be
generalized. If the variable is not generalized but annotated as a type
variable, emit an error.
2025-01-02 14:26:37 -06:00
Richard Feldman
bc0c9250f9
Convert unused dbg!()s to eprintln!()s
This makes it nicer to work with dbg! normally,
because grepping the code base for dbg!() reveals
only the usages of it that are currently active.
2024-12-01 23:10:35 -05:00
faldor20
8549e48d0b
make effectful functions unify properly 2024-12-01 16:09:42 +10:00
Luke Boswell
624021bf49
replace cargo deps with workspace in test_solve_helpers, test_syntax, types, uitest, unify, work, worker 2024-11-29 11:31:48 +11:00
Agus Zubiaga
cfc4be5254
Treat untyped suffixed functions as effectful 2024-11-07 18:54:21 -03:00
Agus Zubiaga
89a918cebe
Fix unifying pure with flex vars 2024-11-07 18:54:19 -03:00
Agus Zubiaga
7af05cc6c9
Constrain function annotation fx to body 2024-11-07 18:54:13 -03:00
Agus Zubiaga
7776883262
Unify functions fx vars 2024-11-07 18:54:13 -03:00
Agus Zubiaga
5a5abe3bc5
Unify call's fx var with that of the enclosing function 2024-11-07 18:54:12 -03:00
Richard Feldman
44d00e1f13
Updates for making soa no_std 2024-10-21 22:10:43 -04:00
Richard Feldman
178bc469e6
Put back a bunch of the push_new etc. calls 2024-10-21 22:10:43 -04:00
Richard Feldman
49d1786f6c
Remove more push_new and extend_new usages 2024-10-21 22:10:43 -04:00
Richard Feldman
2567c8b545
Convert over Subs to use the new soa crate 2024-10-10 00:30:35 -04:00
Richard Feldman
586959780b
Revert "Try out converting subs to use soa stuff directly"
This reverts commit 4a7d7e42d6.
2024-10-10 00:06:25 -04:00
Richard Feldman
4a7d7e42d6
Try out converting subs to use soa stuff directly 2024-10-10 00:06:22 -04:00
Anton-4
81d18cc84b
use dead_code for Both
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2024-07-05 14:17:52 +02:00
Anton-4
05a61e2210
clippy + fmt 2024-06-19 12:34:10 +02:00
Richard Feldman
c4497f2c1c
Remove Nat from Num 2024-01-26 16:19:51 -05:00
Folkert
6ab54c02e2
drop into_iter in some places 2023-10-07 19:11:36 +02:00
Richard Feldman
2da41be29f
Merge remote-tracking branch 'origin/main' into abilities-syntax 2023-08-10 20:36:01 -04:00
Ayaz Hafiz
d7a30966c1
Add explicit casts
For some reason these can no longer be inferred.
2023-07-17 09:50:37 -05:00
Ayaz Hafiz
8d1d4e6df3
debug import 2023-07-17 09:50:37 -05:00
Ayaz Hafiz
5ea9bd19b2
Unify on roots 2023-07-17 09:50:37 -05:00
Ayaz Hafiz
18e9f8f034
Move unify::Mode to roc_solve_schema 2023-07-17 09:50:36 -05:00
Ayaz Hafiz
87d108eccc
Push checkmate through env 2023-07-17 09:48:59 -05:00
Ayaz Hafiz
8097ee3342
Hide subs behind Env deref 2023-07-17 09:48:57 -05:00
Ayaz Hafiz
6e5a308557
Content variant ErasedLambda 2023-07-12 13:57:17 -05:00
Ayaz Hafiz
16ebcba053
Use index 2023-07-12 13:53:51 -05:00
Ayaz Hafiz
15ae7489a8
Unify erased lambda sets 2023-07-12 13:53:51 -05:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Ayaz Hafiz
49a92e5ef1
Support fixpoint-fixing under recursion variables
Sometimes, we might need to fixpoint-fix a unification like

[ Bar [ Bar <a>, Foo ], Foo ] as <a>  🛠️  [ Bar <b>, Foo ] as <b>

where we hit a comparison between <a> and <b>. In this case, follow each
recursion point independently and see if we can find the chain to the needle
we were searching for.

Closes #5476
2023-06-13 17:15:11 -05:00
Bryce Miller
dbc0204532
abilities syntax has -> implements 2023-05-24 21:30:16 -04:00
Ayaz Hafiz
8ca1e6c866
Correct occurs cycle under alias argument but not alias real var
At times we can have alias arguments that are recursive in their
position, but whose recursiveness is not immediately visible in the real
var.

Closes #5330
2023-05-02 17:00:58 -05:00
Ayaz Hafiz
8dc86a81b8
Rename ROC_VERIFY_OCCURS_RECURSION flag 2023-05-02 17:00:58 -05:00
Ayaz Hafiz
5815807927
seen_recursion_pair is immutable 2023-05-02 17:00:58 -05:00
Ayaz Hafiz
238e64c0b3
Defer resolution of a recursion variable during union unification until merging
While unifying two unions, we may turn one of them into a recursive
union. If we don't recognize the recursiveness before merging, we'll
have lost the recursive value of the union.
2023-05-01 13:14:59 -05:00
Ayaz Hafiz
5ec2715820
Correctly introduce new recursion variables at the correct rank 2023-05-01 13:14:59 -05:00
Folkert
394495d307 Revert "update size asserts"
This reverts commit 9973d4b8d2.
2023-04-21 13:22:23 +02:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Ayaz Hafiz
e06eac9769
Be sure to unify recursion var structure if it hasn't been seen 2023-03-27 10:10:56 -05:00
Ayaz Hafiz
f7455deb06
Get rid of inaccurate debug assertion 2023-03-25 15:01:41 -05:00
Ayaz Hafiz
9b7c4bf367
Debug assertion should be negated 2023-03-25 15:01:40 -05:00
Brendan Hansknecht
4a89bee0a5
centralize package versions except for vendor and excluded 2023-03-06 19:29:09 -08:00
Brendan Hansknecht
5485c8a5b0
update to using workspace package spec 2023-03-06 16:36:18 -08:00
Brendan Hansknecht
21af20597e
remove unused dependencies 2023-03-06 12:09:00 -08:00
Ayaz Hafiz
d7a069675b
Lambda set compaction must preserve unique specializations of concrete types
There are times that multiple concrete types may appear in
unspecialized lambda sets that are being unified. The primary case is
during monomorphization, when unspecialized lambda sets join at the same
time that concrete types get instantiated. Since lambda set
specialization and compaction happens only after unifications are
complete, unifications that monomorphize can induce the above-described
situation.

In these cases,

- unspecialized lambda sets that are due to equivalent type variables
  can be compacted, since they are in fact the same specialization.
- unspecialized lambda sets that are due to different type variables
  cannot be compacted, even if their types unify, since they may point
  to different specializations. For example, consider the unspecialized
  lambda set `[[] + [A]:toEncoder:1 + [B]:toEncoder:1]` - this set wants
  two encoders, one for `[A]` and one for `[B]`, which is materially
  different from the set `[[] + [A, B]:toEncoder:1]`.
2023-02-20 18:50:07 -06:00
Ayaz
a7c415dc35
Merge pull request #4940 from joshuawarner32/tuple-solve
Initial implementation of tuples in type checking
2023-01-23 16:25:35 -06:00
Joshua Warner
de828416bf
Initial implementation of tuples in type checking
This leaves in place a bunch of TODOs and likely many bugs - notably, I haven't tested codegen/layout at all here.
2023-01-22 12:40:44 -08:00