Louis Gesbert
ea114bada2
Fix one more typing mismatch
2022-10-04 14:50:37 +02:00
Louis Gesbert
920b3679df
Some more fixes for remaining invalid typing
2022-10-04 14:50:37 +02:00
Louis Gesbert
609cc5cc9a
Tests: add info on manually running a single test
2022-10-04 14:50:37 +02:00
Louis Gesbert
5da55f1605
Fix some remaining invalid type annots
2022-10-04 14:50:37 +02:00
Louis Gesbert
5bb694c7b8
scope_to_dcalc: fix propagating wrong types
...
fill with TAny when building non-trivial things instead (in particular the
toplevel scope structure)
2022-10-04 14:50:37 +02:00
Louis Gesbert
0fdefacf7c
Add marks to scopelang Call
2022-10-04 14:50:37 +02:00
Louis Gesbert
749810625f
Activate double typing
2022-10-04 14:50:37 +02:00
Louis Gesbert
41315dc650
Scopelang: add toplevel mark for convenience
...
it allows to discriminate typed and non-typed ASTs
2022-10-04 14:50:37 +02:00
Louis Gesbert
9349fb918d
Scope: fix getting external body mark
2022-10-04 14:50:37 +02:00
Louis Gesbert
742c4acb3e
Expr.make_app: fix assertion to allow for TAny values
2022-10-04 14:50:37 +02:00
Louis Gesbert
e17baac840
Printer: add debug version that doesn't require a context
...
very handy sometimes...
2022-10-04 14:50:37 +02:00
Louis Gesbert
0de73c4b9b
Clerk: define strings used as variables just once
2022-10-04 14:50:37 +02:00
Louis Gesbert
fd3219a34e
Catala driver: re-run the typer after dcalc compilation
2022-10-04 14:50:37 +02:00
Louis Gesbert
0dbc4c8c35
Separate type ordering from scopelang->dcalc transformation
...
it's now done explicitely from the driver, which allows to do it before typing
and is more consistent; the information was already forwarded to the later
compilation stages separately from the program AST anyway.
2022-10-04 14:50:37 +02:00
Louis Gesbert
ff76d0498f
Make the typer use (and check) already existing annotations, if any
2022-10-04 14:50:37 +02:00
Louis Gesbert
76d1c1cc93
Dcalc.Optimization should reasonably preserve types
...
since it only does reductions while preserving marks. The patch is mostly a
renaming from `pos` to `mark`
2022-10-04 14:50:37 +02:00
Louis Gesbert
12d2833306
Fix cyclic type test
...
Make it type so that it's actually the cycle error that is raised
(now that expression typing is done earlier)
2022-10-04 14:50:37 +02:00
Louis Gesbert
4d8bc20fcd
Test new typing
2022-10-04 14:50:37 +02:00
Louis Gesbert
3b4b070aaa
Fix typing
2022-10-04 14:50:37 +02:00
Louis Gesbert
6701b0760d
Clerk inline tests: tiny improvements
...
- pass Catala options correctly in "clerk run-test"
- filter "OCAMLRUNPARAM" out of the environment (avoids backtraces getting
included in test outputs)
I use the following function in Emacs to live-update a test output:
```elisp
(defun clerk-test-update ()
(interactive nil)
(let ((pos (point)))
(delete-region (point-min) (point-max))
(call-process
"dune" nil t t
"exec" "--display=quiet" "--no-print-directory" "--no-build" "clerk" "--"
"runtest" "-e" "dune" "-c" "exec catala --no-build --"
(buffer-file-name))
(goto-char pos)))
```
2022-10-04 14:50:37 +02:00
Louis Gesbert
a291c202b9
Tests: use patdiff rather than colordiff if available
2022-10-04 14:50:37 +02:00
Louis Gesbert
2955ef3235
Implement typing at the scopelang level
2022-10-04 14:50:37 +02:00
Louis Gesbert
9f7a0f6078
Fix naming error in interface
...
Hmm I used too much `sed` and overlooked this one
(patch looks big because of reformatting, but it's mostly just `naked_expr`→`expr`)
2022-10-04 14:50:37 +02:00
Louis Gesbert
05f4bb3537
Typing: simplify interface, split code in smaller functions
2022-10-04 14:50:37 +02:00
Louis Gesbert
51f79af13e
Generalise the types to allow scopelang ASTs to be typed
2022-10-04 14:50:37 +02:00
Louis Gesbert
5a553149ff
Makefile: ensure compiler is up-to-date when running tests
2022-10-04 14:50:37 +02:00
Louis Gesbert
0ad51b7aec
Unify outermost types first in Typing.top_down
...
It doesn't actually change the error output much, but is more sound, and allowed
to fix a few quirks in the code.
2022-10-04 14:50:37 +02:00
Louis Gesbert
a8816eb9e4
Fix parser message that didn't make sense to me
...
I had the message appear after a `integer_to_decimal` not followed by `of`, but
might it happen in other cases ?
2022-10-04 14:50:37 +02:00
Louis Gesbert
af9f497ffb
Implement typing of desugared/scopelang and lcalc terms
...
Note that this is incomplete in the case of desugared/scopelang because we only
have typing for expressions yet, and the scope/program structure is different.
The code allows passing an environment of types for scope/subscope variables in
order to resolve `ELocation` terms, but that's unused until we implement
scopelang typing at the scope level.
2022-10-04 14:50:37 +02:00
Louis Gesbert
b37a6c3703
Generalise the typer
...
This moves dcalc/typing.ml to shared_ast, and generalises the input type, but
without yet implementing the extra cases (these are all `assert false`): it's
just a first step.
2022-10-04 14:50:37 +02:00
Louis Gesbert
0bb9cce341
Simplify a few mark operations
2022-10-04 14:50:37 +02:00
Louis Gesbert
d93b699a4c
Forward types in the Expr.make_*
constructors
...
Also add some safeguards against bad propagation of types (e.g. checking the
arrow type of functions upon application); partly disabled at the moment since
they don't pass yet but that'll be further work.
2022-10-04 14:50:37 +02:00
Catala nix updated
0ddff5a50b
update lock files
2022-10-03 14:18:24 +00:00
Denis Merigoux
b49d2e701e
build/fix: bump unionFind to last version ( #343 )
2022-10-03 15:35:47 +02:00
lIlIlIlIIIIlIIIllIIlIllIIllIII
55b8e9dffd
build/fix: bump unionFind to last version
...
Fixes #342
2022-10-03 11:29:59 +02:00
Denis Merigoux
65f4635510
A new case
2022-09-28 16:03:14 +02:00
Denis Merigoux
6b24f7145d
Fix bug
2022-09-27 16:10:23 +02:00
Denis Merigoux
9cb7e86bfc
List to investigate
2022-09-26 19:28:07 +02:00
Denis Merigoux
0a9a593c61
Restore base input
2022-09-26 19:23:30 +02:00
Denis Merigoux
89dab52caa
Tweaks
2022-09-26 19:19:15 +02:00
Denis Merigoux
e6ba0980d8
CNAF->Catala input conversion (injection but not surjection)
2022-09-26 19:01:29 +02:00
Denis Merigoux
a805ac0acc
Minor tweaks
2022-09-26 17:35:43 +02:00
Denis Merigoux
0beaf6eb31
Comparing with Catala!
2022-09-26 17:29:05 +02:00
Denis Merigoux
0c0267055e
Update assets
2022-09-26 15:59:11 +02:00
Denis Merigoux
7ab74501b8
Playing mouse and cat with the CNAF form
2022-09-26 15:44:38 +02:00
Denis Merigoux
309dfb6c3e
Random input generator
2022-09-26 15:44:30 +02:00
Louis Gesbert
c1078e1f82
Fix & improve typing messages ( #341 )
2022-09-26 15:36:45 +02:00
Louis Gesbert
3d73071012
Typing tests: reword test doc for clarity
2022-09-26 15:27:36 +02:00
Louis Gesbert
a41de29293
Improve typing error message on <any> array
...
- don't print variable id on type variables, there should be no ambiguity
- print "array" as "collection" to match the language
- print just "collection" for "'a collection", which makes sense english-wise
2022-09-26 14:29:15 +02:00
Louis Gesbert
abd5a4de96
Tests: cleanup remaining whitespace
2022-09-26 14:27:47 +02:00