Commit graph

218 commits

Author SHA1 Message Date
Agus Zubiaga
519ff56a85
Create can::module::ModuleParams for convenience 2024-08-17 13:10:37 -03:00
Agus Zubiaga
7a8b9f7d6d
Add variable to ParamsVar 2024-08-16 20:54:16 -03:00
Agus Zubiaga
0cbb352a89
Move unexpected params warning to solve 2024-07-06 21:36:26 -03:00
Agus Zubiaga
922b1c44ef
Report missing params 2024-07-02 11:10:00 -03:00
Agus Zubiaga
f0fe0a3ea6
Module params are not extensible 2024-07-02 04:10:47 -03:00
Agus Zubiaga
5ec4b042bb
Constrain and solve import params
No reporting yet
2024-07-02 04:10:46 -03:00
Agus Zubiaga
50b1a60411
Reuse Var constrain for ParamsVar 2024-07-02 04:10:46 -03:00
Agus Zubiaga
8f69e75a95
Contrain module params pattern 2024-07-02 04:10:46 -03:00
Agus Zubiaga
674adf1fad
Wrap import params expr so we can constrain later 2024-07-02 04:10:46 -03:00
Agus Zubiaga
1526fc4aee
can::Expr::ParamsVar for lookups with params 2024-07-02 04:10:44 -03:00
JRI98
f4551978ce
Handle multi pattern unbound list rest variables 2024-06-21 17:01:49 +01:00
Agus Zubiaga
710d62f754
Load and can new top-level imports
Previously, all imports were available in the header, so we could start
processing dependencies as soon as we parsed it. However, the new imports
are treated as defs, so we have to parse the whole module to find them.

This commit essentially moves the dependency resolution from the `LoadHeader`
phase to the `Parse` phase, and it updates canonicalization to introduce
module symbols into scope when a `ValueDef::ModuleImport` is encountered.

NOTE:
- The `imports` header still parses, but it's no longer wired up. I will remove
it in an upcoming commit.
- Ingested files and imports that appear in nested expressions are not
yet supported by load
2024-01-20 08:39:31 -03:00
Brendan Hansknecht
3966d63e2f
add src and location to dbg 2023-12-02 21:18:31 -08:00
Brendan Hansknecht
b7f72eff86
add basic Dbg desugaring and LowLevelDbg 2023-11-29 21:05:48 -08:00
jecaro
c858031f74
Show the right fct name in type error messages 2023-11-16 16:44:55 +01:00
Ayaz Hafiz
d3273381f7
Use store constraint instead of eq 2023-07-24 21:02:56 -05:00
Folkert
2756c9af35
switching constraint order fixes things 2023-07-24 21:24:34 +02:00
Folkert
557c3987e0
make it work 2023-07-24 21:24:33 +02:00
Folkert
ef39bad7c6
auto clippy fixes 2023-07-10 18:27:08 +02:00
Ayaz Hafiz
ee2a195525
s/loc_guard/loc_pattern 2023-05-24 13:12:47 -05:00
Ayaz Hafiz
815ae5df9d
Mark named destructures under records as open 2023-05-24 13:12:41 -05:00
Agustin Zubiaga
71a2990e21 Tip replacing <- with : for static values 2023-05-09 23:37:24 -03:00
Ayaz
4824de5192
Merge pull request #5363 from roc-lang/i5344
Correctly include flex vars in generalization group of rec defs
2023-05-02 16:44:29 -05:00
Ayaz Hafiz
d4fcd83ba9
Correctly include flex vars in generalization group of rec defs
Rather than resetting the list here, we should append to it!

Closes #5344
2023-05-02 13:18:50 -05:00
Ayaz
cdf8677dfb
Merge pull request #5287 from roc-lang/i5236
Catch non-recursive function arity mismatches during typechecking
2023-05-01 14:46:20 -05:00
Folkert
4cd8f0a056 clippy --fix fixes 2023-04-21 12:05:51 +02:00
Ayaz Hafiz
dc9c5b13db
Introduce unannotated function arguments to the env as appropriate 2023-04-20 16:16:40 -05:00
Ayaz Hafiz
70adb39483
Unnecessary clone 2023-04-20 10:11:30 -05:00
Ayaz Hafiz
6df0caa6ac
Handle function arity checking in nested closures 2023-04-20 10:10:52 -05:00
Ayaz Hafiz
b46392311e
Catch functions typed with too few arguments
Closes #5264
2023-04-20 10:10:50 -05:00
Ayaz Hafiz
e5b619780c
Unnecessary return 2023-04-10 16:36:45 -05:00
Ayaz Hafiz
b9ab93fd98
Introduce annotation in first step of recursive solving independently
The algorithm for solving recursive definitions proceeds in several
steps. There are three main phases: introduction of what's known,
solving what's not known, and then checking our work of what was
inferred against what the programmer claimed. Concretely:

1. All explicitly-annotated signatures in the mutually recursive set are
   introduced and let-generalized.
2. Then, inference type variables (`_`) and unannotated def signatures are
   introduced to the cycle, without generalization. The bodies of these
   defs, that are either unannotated or have inference variables, are
   solved.
3. The defs from step (2) are now let-generalized, since we now know
   that their types are consistent. At this point, all the defs in the
   cycle have their types introduced and let-generalized, but we still
   haven't checked the bodies of the defs froom step (1).
4. Check the bodies of explicitly-annotated defs in recursive set. This
   might materially affect the actual types in the signature, for
   example do to fixpoint-fixing or alias expansion.
5. As a result of (4) possibly changing the structure of the annotated
   type, and because the previous annotated types in (1) were introduced
   at a lower rank, we now re-introduce and re-generalize the solved def
   types, in the same we did in step (3).
5. The rest of the program is solved.

Now, a very important thing here is that the annotation signature
introduced for (1) consists of different type variables than the
annotation signature introduced in (5). The reason is that they live at
different ranks. Prior to this patch we were not explicilty doing so;
this commit ensures that we do.
2023-04-10 16:31:00 -05:00
Ayaz Hafiz
352345d1d9
Refactor expr constraining to align with top-level constraining 2023-04-10 15:46:15 -05:00
Ayaz Hafiz
7fa508b3c8
Refactor headers_from_annotation to match over TypeTag 2023-04-10 15:44:11 -05:00
Brendan Hansknecht
6302a8d4b5
switch from type annotation to type variable 2023-04-09 14:03:33 -07:00
Brendan Hansknecht
ff414610ca
clippy
add basic test case for now in helloworld

reset helloworld back to original example

reset helloworld back to original example
2023-04-09 14:03:32 -07:00
Brendan Hansknecht
08179d2a65
make errors more correct and check for utf8 bytes 2023-04-09 14:03:32 -07:00
Brendan Hansknecht
07eb3614ea
get ingesting working both for Str and List U8 2023-04-09 14:03:32 -07:00
Brendan Hansknecht
d42aa43b41
add ingest file to can ir and start pipelining it through the compiler 2023-04-09 14:03:32 -07:00
Brendan Hansknecht
f42f61e271
run a toml formatter and then clean it up a bit 2023-03-06 19:47:57 -08: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
c9e4badd93
update as many dependencies as possible to use the workspace version of the package 2023-03-06 12:43:48 -08:00
Joshua Warner
5a6be05ead
implement mono / lowering for tuples 2023-02-07 18:54:50 -08:00
Folkert de Vries
7aaf0f3822
Merge pull request #4916 from roc-lang/rust1_65
upgrade to rust 1.65 and clippy fixes
2023-01-24 14:14:10 +01: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
Anton-4
f00a9b1748
Merge branch 'main' into rust1_65
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2023-01-17 20:14:44 +01:00
Ayaz
ed7123ed5b
Merge pull request #4887 from roc-lang/weakening-5
Finish weakening let-bindings
2023-01-17 12:47:12 -06:00
Anton-4
35b93f0d1e
use new name for clippy error 2023-01-17 18:19:17 +01:00
Anton-4
bbf35af8fa
Merge branch 'main' into rust1_65
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
2023-01-17 18:14:30 +01:00