Commit Graph

2795 Commits

Author SHA1 Message Date
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
Louis Gesbert
3ceb9ec80c Clerk: don't stop on 1st error on tests 2022-09-26 14:24:49 +02:00
Louis Gesbert
c18de3b980 Tweak the order in which typing is done 2022-09-26 14:11:25 +02:00
Louis Gesbert
76569bb1af Fix position on type error concerning sub-scope variable 2022-09-26 14:11:25 +02:00
Louis Gesbert
498429e4b7 Fix type-checking error getting delayed
The issue was coming from Bindlib: it stores variable bindings as closures, so
`Bindlib.box_apply f bx` actually delays the application of `f` until the term
is substituted or unboxed (likely long after we are out of the `try..with`
block).

The proposed fix is to make sure we run the wrapper outside of bindlib
applications, on explicitely unboxed terms.
2022-09-26 14:11:25 +02:00
Louis Gesbert
8bf6b5b821 Type arrow return types first 2022-09-26 14:11:25 +02:00
Louis Gesbert
2c3be946ec Keep type positions on the right-hand side upon unification of types
This should result in more predictable error messages. Right-hand is arbitrary,
but has been found empirically to give better results.
2022-09-26 14:11:25 +02:00
Louis Gesbert
43e4efeeb8 Some typing error tests improvements 2022-09-26 14:11:25 +02:00
Denis Merigoux
2460dffe3f
Starting random input generator 2022-09-26 13:28:07 +02:00
Denis Merigoux
8dd45788a6
Automation of the CNAF's site working 2022-09-26 13:28:07 +02:00
Denis Merigoux
4df71d8bae
Beginning to port https://github.com/jboillot/apl-fetcher 2022-09-26 13:28:07 +02:00
Denis Merigoux
365037f70c
Correctly bench 2022-09-26 13:28:07 +02:00
Denis Merigoux
463b0965e3
Same example in Puython and in JS 2022-09-26 13:28:07 +02:00
Denis Merigoux
3f62a99b7a
Remove erroneous import 2022-09-26 13:28:07 +02:00
Denis Merigoux
32c89cc3a2
Fix Python backend for housing benefits 2022-09-26 13:28:07 +02:00
Denis Merigoux
89b625642f
Money from int and not from float 2022-09-26 13:28:06 +02:00
Denis Merigoux
431a0b99c1
Initial writeup of Python calling to housing benefits 2022-09-26 13:28:06 +02:00
Catala nix updated
e53f6b6087 update lock files 2022-09-26 00:28:43 +00:00
Louis Gesbert
84c1063509
Change the clerk tests to use inline output (#340) 2022-09-23 17:06:05 +02:00
Louis Gesbert
8c1696d0ff Inline tests: cleanup trailing whitespace 2022-09-23 16:56:21 +02:00