Commit Graph

3580 Commits

Author SHA1 Message Date
Louis Gesbert
bd90555e96 The interpreter might return custom terms
since scope outputs may contain functions this shouldn't be excluded; functions
from the interpreter now reflect this
2023-10-13 16:16:45 +02:00
Louis Gesbert
3b0e576a24 Fix module name propagation 2023-10-13 16:13:02 +02:00
Louis Gesbert
f25e38a6d7 Add complete scope call tests (across modules) 2023-10-13 16:12:19 +02:00
Louis Gesbert
2d062a4ad0 Fix bug in dependency analysis around scope call arguments 2023-10-13 16:12:15 +02:00
Louis Gesbert
d09113163d Fix bug in dependency analysis around scope call arguments 2023-10-13 15:09:36 +02:00
Louis Gesbert
61ec34e3d9 Fix handling of context vars with all call cases 2023-10-12 14:47:43 +02:00
Louis Gesbert
af8ff472a5 Fix handing of context variables in modules
The call convention imposes a translation of their types within the scope input
structs definitions in dcalc.
2023-10-12 14:42:57 +02:00
Louis Gesbert
f8b6e60e16 Fix handling of context variables in the interpreter 2023-10-12 14:42:57 +02:00
Louis Gesbert
dec0ca2041 Update reformatting patches list 2023-10-12 14:42:57 +02:00
Louis Gesbert
4f22f412d2 Clerk: fix catala lookup function again 2023-10-11 13:47:37 +02:00
Louis Gesbert
186e2dfa64 Clerk: fix lookup of 'catala' command in PATH 2023-10-11 12:03:10 +02:00
Denis Merigoux
24e43861f8
Fix wrongly located catala runtime library 2023-10-10 14:11:53 +02:00
Denis Merigoux
aa0ab95230
Clerk: ensure error messages are printed properly (#522) 2023-10-10 14:04:42 +02:00
Louis Gesbert
a9dc1f46b4 Clerk: ensure error messages are printed properly 2023-10-09 11:23:50 +02:00
Louis Gesbert
9d12e15f77
Rehaul the Clerk build system (#512) 2023-10-05 16:26:15 +02:00
Louis Gesbert
2708fa53b2 Reformat 2023-10-03 18:50:18 +02:00
Louis Gesbert
263cf3a9f7 Fix line-lexer on french syntax
"Usage de" being two words was tripping it
2023-10-03 18:49:16 +02:00
Louis Gesbert
2c6e6bf0b5 Disambiguate constructors and fields across modules 2023-10-03 18:49:00 +02:00
Louis Gesbert
8194abaf93 Operator mismatch fix
wow this remained unspotted for some time...
2023-10-03 18:44:12 +02:00
Louis Gesbert
22045a2f06 Tests and fixes on structures across modules 2023-10-03 18:43:14 +02:00
Louis Gesbert
e9a028c5f2 Clerk: use tag suffixes rather than prefixes
Clerk always generates parent dirs so using prefixes resulted in empty
`test@foo/bar` directories getting created
2023-10-02 18:24:24 +02:00
Louis Gesbert
cc7c3fc18c Clerk: add more tests, and small fixes 2023-10-02 17:51:16 +02:00
Louis Gesbert
a79acd1fa8 Reformat 2023-09-27 13:19:04 +02:00
Louis Gesbert
ce17d8e563 Fix plugins compilation 2023-09-27 13:18:28 +02:00
Louis Gesbert
a0405e31d5 Clerk: cleanup how test diffing/resetting is handled 2023-09-27 13:18:28 +02:00
Louis Gesbert
ade51234e8 Discard catala option --build-dir that is not useful in the end 2023-09-27 13:18:28 +02:00
Louis Gesbert
50fad76df3 Clerk: copy files to _build and run catala there
this is more consistent, avoids empty stamp files and should make things simpler
overall.

The slightly tricky `-C` option is added to Catala so that it can be run from
_build while paths to source and destination files are still specified relative
to CWD (Ninja doesn't provide string manipulation, so otherwise we would have to
explicit both the `_build/dir/` and `dir/` versions of each path).
2023-09-27 13:18:28 +02:00
Louis Gesbert
5efa61a0ce Clerk: rewrite 'clerk runtest' to use the new lightweight lexer
* Obsolete code for included tests has been removed

* The engine uses a proper lexer and is much simplified

* An inline test in the middle of the file now only "sees" the file up to that
  point. This fixes an issue where we had spurious errors when a type error was
  added at the end of a file, and it would pop up in tests before it. This makes
  files including many tests much more practical.

* diffing and resetting the tests has been reintroduced (done at the moment in
  Ninja, but for more control (count number of failed tests, etc.) we could put it
  back into Clerk at some point

* The Catala CLI can now take an input from stdin (with the possibility to link
  a (possibly fake) on-disk file for error reporting and file locations ; this
  is useful for running tests)
2023-09-27 13:18:18 +02:00
Louis Gesbert
cc7066e9a8 Clerk: better handling of transitive dependencies
We need a concrete intermediate target for e.g. transitive uses of `> Include`
for Ninja to correctly handle them.

Of course we could also unroll all transitive dependencies, but meh.

Note also that now tests now just generate the outputs but facilities for
diffing and resetting are temporarily absent.
2023-09-27 13:14:40 +02:00
Louis Gesbert
dbe0990163 Rework module includes CLI in Catala
Rather than require all files to be listed on the command-line (and having to
check consistency with `> Using` directives), the main catala CLI is now a bit
more clever.

⇒ There is a new assumption that a module name definition must match the file
name (up to case and extension) — with appropriate error handling to enforce it.

In exchange, `> Using` directives are now used to more transparently lookup the
appropriate `.catala_*` interfaces and the compiled artifacts for the used modules (handling transitive dependencies), with just standard `-I` flags for when they need to be looked up in different places.
2023-09-27 13:14:40 +02:00
Louis Gesbert
4bce4e6322 Reformat 2023-09-27 13:14:38 +02:00
Louis Gesbert
094c5f94f6 Clerk: add 'clerk build' subcommand
that allows to build arbitrary targets passed through to Ninja
2023-09-27 13:14:08 +02:00
Louis Gesbert
442997aea5 Clerk: rework CLI to use subcommands 2023-09-27 13:14:08 +02:00
Louis Gesbert
f162f6e9bd Improve handling of module name definitions
and add some sanity-checks for consistency of used modules w.r.t. actually
loaded modules.
2023-09-27 13:14:03 +02:00
Louis Gesbert
22c69938b6 Fix handling of "output" tests
I.e. our legacy tests with a separate output tests, to distinguish from inline
tests.
2023-09-27 13:08:15 +02:00
Louis Gesbert
326990678f Enforce recent yojson version
2.0 doesn't need biniou or easy_format anymore
2023-09-27 13:08:15 +02:00
Louis Gesbert
1ee2980ae7 Clerk: enable by-directory test targets 2023-09-27 13:08:15 +02:00
Louis Gesbert
63773e48b5 Update tests outputs 2023-09-27 13:08:15 +02:00
Louis Gesbert
55e8e24cab Clerk: re-enable 'clerk run' 2023-09-27 13:08:15 +02:00
Louis Gesbert
f8e3774662 Fix lookup of built modules in Catala 2023-09-27 13:08:15 +02:00
Louis Gesbert
60fe40e25b Clerk: fix some module linking options 2023-09-27 13:08:15 +02:00
Louis Gesbert
494be673a8 Rehaul the Clerk build system to fully handle modules and linking 2023-09-27 13:08:15 +02:00
Louis Gesbert
8eb254aa32 Rename tests with ambiguous outputs
With modules, it's not reasonable to allow two catala files with the same
basename but different langs
2023-09-27 13:08:15 +02:00
Louis Gesbert
cf8f365cf7 Extract Catala version from dune
(avoids multiple, possibly inconsistent, definitions ; also syncs up Clerk
versions with Catala)
2023-09-27 13:08:15 +02:00
Louis Gesbert
94ec864890 Scan file tree: proceed in sequence 2023-09-27 13:08:15 +02:00
Louis Gesbert
bf048f0a74 Add a lightweight lexer for dependency extraction in Clerk
The base is there but not fully used yet in Clerk
2023-09-27 13:08:15 +02:00
Louis Gesbert
9aed2c7479 support for parsing Module directives 2023-09-27 13:08:11 +02:00
Louis Gesbert
9445f83407
Improve assertion failure message (#518) 2023-09-27 13:07:38 +02:00
Denis Merigoux
ec18ac10bb
Fix missing implem 2023-09-22 18:06:44 +02:00
Denis Merigoux
1f4805caad
Print interpreter error messages with localized expression printer 2023-09-22 18:06:43 +02:00