- 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)))
```
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.
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.
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.
- 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
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.