Allow access to intermediate variable states (#578)

This commit is contained in:
Louis Gesbert 2024-02-13 11:04:51 +01:00 committed by GitHub
commit 1087604060
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
232 changed files with 657 additions and 579 deletions

View File

@ -512,7 +512,7 @@ let[@ocamlformat "disable"] static_base_rules =
!post_test; !input; ";";
"echo"; "-n"; "$$?"; ">"; !output;
]
~description:["<test>"; !output];
~description:["<test>"; !test_id];
Nj.rule "interpret"
~command:
@ -522,7 +522,7 @@ let[@ocamlformat "disable"] static_base_rules =
Nj.rule "dir-tests"
~command:["cat"; !input; ">"; !output; ";"]
~description:["<test>"; !output];
~description:["<test>"; !test_id];
Nj.rule "test-results"
~command:[
@ -714,6 +714,7 @@ let gen_build_statements
Nj.build "post-test" ~inputs:[reference; test_out]
~implicit_in:["always"]
~outputs:[(!Var.builddir / reference) ^ "@post"]
~vars:[Var.test_id, [reference]]
:: acc)
[] item.legacy_tests
in
@ -738,6 +739,7 @@ let gen_build_statements
~outputs:[inc (srcv ^ label)]
~inputs:[srcv; inc (srcv ^ "@out")]
~implicit_in:["always"]
~vars:[Var.test_id, [srcv]]
in
match item.legacy_tests with
| [] ->
@ -755,7 +757,8 @@ let gen_build_statements
@ List.map
(fun test ->
(!Var.builddir / legacy_test_reference test) ^ "@post")
legacy);
legacy)
~vars:[Var.test_id, [srcv]];
results;
]
in
@ -800,7 +803,10 @@ let dir_test_rules dir subdirs items =
List.to_seq
[
Nj.Comment "";
Nj.build "dir-tests" ~outputs:[(Var.(!builddir) / dir) ^ "@test"] ~inputs;
Nj.build "dir-tests"
~outputs:[(Var.(!builddir) / dir) ^ "@test"]
~inputs
~vars:[Var.test_id, [dir]];
Nj.build "test-results"
~outputs:[dir ^ "@test"]
~inputs:[(Var.(!builddir) / dir) ^ "@test"];

View File

@ -360,14 +360,17 @@ let rec translate_expr
correct calendar day")
in
Expr.elit lit emark
| Ident ([], (x, pos)) -> (
| Ident ([], (x, pos), state) -> (
(* first we check whether this is a local var, then we resort to scope-wide
variables, then global variables *)
match Ident.Map.find_opt x local_vars with
| Some uid ->
match Ident.Map.find_opt x local_vars, state with
| Some uid, None ->
Expr.make_var uid emark
(* the whole box thing is to accomodate for this case *)
| None -> (
| Some uid, Some state ->
Message.raise_spanned_error (Mark.get state)
"%a is a local variable, it has no states" Print.var uid
| None, state -> (
match Ident.Map.find_opt x scope_vars with
| Some (ScopeVar uid) ->
(* If the referenced variable has states, then here are the rules to
@ -376,36 +379,55 @@ let rec translate_expr
the previous state in the chain. *)
let x_sig = ScopeVar.Map.find uid ctxt.var_typs in
let x_state =
match x_sig.var_sig_states_list with
| [] -> None
| states -> (
match inside_definition_of with
| Some (Var (x'_uid, sx'), _) when ScopeVar.compare uid x'_uid = 0
-> (
match sx' with
| None ->
failwith
"inconsistent state: inside a definition of a variable with \
no state but variable has states"
| Some inside_def_state ->
if StateName.compare inside_def_state (List.hd states) = 0 then
Message.raise_spanned_error pos
"It is impossible to refer to the variable you are \
defining when defining its first state."
else
(* Tricky: we have to retrieve in the list the previous state
with respect to the state that we are defining. *)
let rec find_prev_state = function
| [] -> None
| st0 :: st1 :: _ when StateName.equal inside_def_state st1
->
Some st0
| _ :: states -> find_prev_state states
in
find_prev_state states)
| _ ->
(* we take the last state in the chain *)
Some (List.hd (List.rev states)))
match state, x_sig.var_sig_states_list, inside_definition_of with
| None, [], _ -> None
| Some st, [], _ ->
Message.raise_spanned_error (Mark.get st)
"Variable %a does not define states" ScopeVar.format uid
| st, states, Some (Var (x'_uid, sx'), _)
when ScopeVar.equal uid x'_uid -> (
if st <> None then
(* TODO *)
Message.raise_spanned_error
(Mark.get (Option.get st))
"Referring to a previous state of the variable being defined \
is not supported at the moment.";
match sx' with
| None ->
failwith
"inconsistent state: inside a definition of a variable with no \
state but variable has states"
| Some inside_def_state ->
if StateName.compare inside_def_state (List.hd states) = 0 then
Message.raise_spanned_error pos
"It is impossible to refer to the variable you are defining \
when defining its first state."
else
(* Tricky: we have to retrieve in the list the previous state
with respect to the state that we are defining. *)
let rec find_prev_state = function
| [] -> None
| st0 :: st1 :: _ when StateName.equal inside_def_state st1 ->
Some st0
| _ :: states -> find_prev_state states
in
find_prev_state states)
| Some st, states, _ -> (
match
Ident.Map.find_opt (Mark.remove st) x_sig.var_sig_states_idmap
with
| None ->
Message.raise_multispanned_error
~suggestion:(List.map StateName.to_string states)
[
None, Mark.get st;
Some "Variable defined here", Mark.get (ScopeVar.get_info uid);
]
"Reference to unknown variable state"
| some -> some)
| _, states, _ ->
(* we take the last state in the chain *)
Some (List.hd (List.rev states))
in
Expr.elocation
(DesugaredScopeVar { name = uid, pos; state = x_state })
@ -416,13 +438,21 @@ let rec translate_expr
| None -> (
match Ident.Map.find_opt x ctxt.local.topdefs with
| Some v ->
if state <> None then
Message.raise_spanned_error pos
"Access to intermediate states is only allowed for variables of \
the current scope";
Expr.elocation
(ToplevelVar { name = v, Mark.get (TopdefName.get_info v) })
emark
| None ->
Name_resolution.raise_unknown_identifier
"for a local, scope-wide or global variable" (x, pos))))
| Ident (path, name) -> (
| Ident (_ :: _, (_, pos), Some _) ->
Message.raise_spanned_error pos
"Access to intermediate states is only allowed for variables of the \
current scope"
| Ident (path, name, None) -> (
let ctxt = Name_resolution.module_ctx ctxt path in
match Ident.Map.find_opt (Mark.remove name) ctxt.local.topdefs with
| Some v ->
@ -433,7 +463,7 @@ let rec translate_expr
Name_resolution.raise_unknown_identifier "for an external variable" name)
| Dotted (e, ((path, x), _ppos)) -> (
match path, Mark.remove e with
| [], Ident ([], (y, _))
| [], Ident ([], (y, _), None)
when Option.fold scope ~none:false ~some:(fun s ->
Name_resolution.is_subscope_uid s ctxt y) ->
(* In this case, y.x is a subscope variable *)

View File

@ -189,7 +189,8 @@ and naked_expression =
(path * uident Mark.pos) Mark.pos * (lident Mark.pos * expression) list
| ArrayLit of expression list
| Tuple of expression list
| Ident of path * lident Mark.pos
| Ident of path * lident Mark.pos * lident Mark.pos option
(* path, ident, state *)
| Dotted of expression * (path * lident Mark.pos) Mark.pos
(** Dotted is for both struct field projection and sub-scope variables *)

File diff suppressed because it is too large Load Diff

View File

@ -164,14 +164,21 @@ let mbinder ==
let expression :=
| e = addpos(naked_expression) ; <>
let state_qualifier ==
| STATE ; state = addpos(LIDENT); <>
let naked_expression ==
| id = addpos(LIDENT) ; {
match Localisation.lex_builtin (Mark.remove id) with
| Some b -> Builtin b
| None -> Ident ([], id)
| id = addpos(LIDENT) ; state = option(state_qualifier) ; {
match Localisation.lex_builtin (Mark.remove id), state with
| Some b, None -> Builtin b
| Some _, Some _ ->
Message.raise_spanned_error
(Pos.from_lpos $loc(id))
"Invalid use of built-in @{<bold>%s@}" (Mark.remove id)
| None, state -> Ident ([], id, state)
}
| uid = uident ; DOT ; qlid = qlident ; {
let path, lid = qlid in Ident (uid :: path, lid)
let path, lid = qlid in Ident (uid :: path, lid, None)
}
| l = literal ; {
Literal l

View File

@ -37,7 +37,7 @@ $ catala Interpret -s Dec
division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:20.23-20.30:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:20.23-20.30:
└──┐
20 │ definition i equals 1. / 0.
│ ‾‾‾‾‾‾‾
@ -45,7 +45,7 @@ The division operator:
└─ with decimals
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:20.28-20.30:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:20.28-20.30:
└──┐
20 │ definition i equals 1. / 0.
│ ‾‾
@ -60,7 +60,7 @@ $ catala Interpret -s Int
division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:10.23-10.28:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:10.23-10.28:
└──┐
10 │ definition i equals 1 / 0
│ ‾‾‾‾‾
@ -68,7 +68,7 @@ The division operator:
└─ with integers
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:10.27-10.28:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:10.27-10.28:
└──┐
10 │ definition i equals 1 / 0
│ ‾
@ -83,7 +83,7 @@ $ catala Interpret -s Money
division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:30.23-30.35:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:30.23-30.35:
└──┐
30 │ definition i equals $10.0 / $0.0
│ ‾‾‾‾‾‾‾‾‾‾‾‾
@ -91,7 +91,7 @@ The division operator:
└─ with money
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:30.31-30.35:
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:30.31-30.35:
└──┐
30 │ definition i equals $10.0 / $0.0
│ ‾‾‾‾

View File

@ -11,12 +11,12 @@ $ catala typecheck
[ERROR]
Please add parentheses to explicit which of these operators should be applied first
┌─⯈ tests/test_arithmetic/bad/logical_prio.catala_en:6.28-6.31:
┌─⯈ tests/arithmetic/bad/logical_prio.catala_en:6.28-6.31:
└─┐
6 │ definition o equals true and (false and true and true) or false
│ ‾‾‾
┌─⯈ tests/test_arithmetic/bad/logical_prio.catala_en:6.58-6.60:
┌─⯈ tests/arithmetic/bad/logical_prio.catala_en:6.58-6.60:
└─┐
6 │ definition o equals true and (false and true and true) or false
│ ‾‾

View File

@ -16,21 +16,21 @@ $ catala Interpret -s A
I don't know how to apply operator >= on types integer and
money
┌─⯈ tests/test_array/bad/fold_error.catala_en:10.48-10.55:
┌─⯈ tests/array/bad/fold_error.catala_en:10.48-10.55:
└──┐
10 │ definition list_high_count equals number of (m >= $7) for m among list
│ ‾‾‾‾‾‾‾
└─ Article
Type integer coming from expression:
┌─⯈ tests/test_array/bad/fold_error.catala_en:5.32-5.39:
┌─⯈ tests/array/bad/fold_error.catala_en:5.32-5.39:
└─┐
5 │ context list content list of integer
│ ‾‾‾‾‾‾‾
└─ Article
Type money coming from expression:
┌─⯈ tests/test_array/bad/fold_error.catala_en:10.53-10.55:
┌─⯈ tests/array/bad/fold_error.catala_en:10.53-10.55:
└──┐
10 │ definition list_high_count equals number of (m >= $7) for m among list
│ ‾‾

View File

@ -121,7 +121,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 11;
catala_fatal_error_raised.position.start_column = 11;
catala_fatal_error_raised.position.end_line = 11;
@ -158,7 +158,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict_1) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 11;
catala_fatal_error_raised.position.start_column = 11;
catala_fatal_error_raised.position.end_line = 11;
@ -181,7 +181,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
if (match_arg.code == option_1_enum_none_1_cons) {
void* /* unit */ dummy_var = match_arg.payload.none_1_cons;
catala_fatal_error_raised.code = catala_no_value_provided;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 11;
catala_fatal_error_raised.position.start_column = 11;
catala_fatal_error_raised.position.end_line = 11;
@ -203,7 +203,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
if (match_arg_1.code == option_1_enum_none_1_cons) {
void* /* unit */ dummy_var = match_arg_1.payload.none_1_cons;
catala_fatal_error_raised.code = catala_no_value_provided;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 11;
catala_fatal_error_raised.position.start_column = 11;
catala_fatal_error_raised.position.end_line = 11;
@ -249,7 +249,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict_2) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 12;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 12;
@ -282,7 +282,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict_3) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 12;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 12;
@ -332,7 +332,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict_4) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 12;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 12;
@ -361,7 +361,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
if (match_arg_4.code == option_2_enum_none_2_cons) {
void* /* unit */ dummy_var = match_arg_4.payload.none_2_cons;
catala_fatal_error_raised.code = catala_no_value_provided;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 12;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 12;
@ -402,7 +402,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
}
if (exception_conflict_5) {
catala_fatal_error_raised.code = catala_conflict;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 13;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 13;
@ -425,7 +425,7 @@ baz_struct baz_func(baz_in_struct baz_in) {
if (match_arg_5.code == option_3_enum_none_3_cons) {
void* /* unit */ dummy_var = match_arg_5.payload.none_3_cons;
catala_fatal_error_raised.code = catala_no_value_provided;
catala_fatal_error_raised.position.filename = "tests/test_backends/simple.catala_en";
catala_fatal_error_raised.position.filename = "tests/backends/simple.catala_en";
catala_fatal_error_raised.position.start_line = 13;
catala_fatal_error_raised.position.start_column = 10;
catala_fatal_error_raised.position.end_line = 13;

View File

@ -18,21 +18,21 @@ Error during typechecking, incompatible types:
└─⯈ bool
While typechecking the following expression:
┌─⯈ tests/test_bool/bad/bad_assert.catala_en:9.13-9.14:
┌─⯈ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
└─┐
9 │ assertion x
│ ‾
└─ Test
Type integer is coming from:
┌─⯈ tests/test_bool/bad/bad_assert.catala_en:5.20-5.27:
┌─⯈ tests/bool/bad/bad_assert.catala_en:5.20-5.27:
└─┐
5 │ output x content integer
│ ‾‾‾‾‾‾‾
└─ Test
Type bool is coming from:
┌─⯈ tests/test_bool/bad/bad_assert.catala_en:9.13-9.14:
┌─⯈ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
└─┐
9 │ assertion x
│ ‾

View File

@ -16,14 +16,14 @@ Error during typechecking, incompatible types:
└─⯈ bool
This expression has type integer:
┌─⯈ tests/test_bool/bad/test_xor_with_int.catala_en:8.30-8.32:
┌─⯈ tests/bool/bad/test_xor_with_int.catala_en:8.30-8.32:
└─┐
8 │ definition test_var equals 10 xor 20
│ ‾‾
└─ 'xor' should be a boolean operator
Expected type bool coming from expression:
┌─⯈ tests/test_bool/bad/test_xor_with_int.catala_en:8.33-8.36:
┌─⯈ tests/bool/bad/test_xor_with_int.catala_en:8.33-8.36:
└─┐
8 │ definition test_var equals 10 xor 20
│ ‾‾‾

View File

@ -28,12 +28,12 @@ $ catala Interpret -s Test
[ERROR]
You cannot set multiple date rounding modes
┌─⯈ tests/test_date/bad/rounding_option_conflict.catala_en:10.14-10.24:
┌─⯈ tests/date/bad/rounding_option_conflict.catala_en:10.14-10.24:
└──┐
10 │ date round decreasing
│ ‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_date/bad/rounding_option_conflict.catala_en:12.14-12.24:
┌─⯈ tests/date/bad/rounding_option_conflict.catala_en:12.14-12.24:
└──┐
12 │ date round increasing
│ ‾‾‾‾‾‾‾‾‾‾

View File

@ -12,19 +12,19 @@ $ catala Interpret -s A
I don't know how to apply operator <= on types date and
duration
┌─⯈ tests/test_date/bad/substraction.catala_en:6.23-6.52:
┌─⯈ tests/date/bad/substraction.catala_en:6.23-6.52:
└─┐
6 │ definition o equals |2024-01-16| - 0 day <= 0 day
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Type date coming from expression:
┌─⯈ tests/test_date/bad/substraction.catala_en:6.23-6.43:
┌─⯈ tests/date/bad/substraction.catala_en:6.23-6.43:
└─┐
6 │ definition o equals |2024-01-16| - 0 day <= 0 day
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Type duration coming from expression:
┌─⯈ tests/test_date/bad/substraction.catala_en:6.47-6.52:
┌─⯈ tests/date/bad/substraction.catala_en:6.47-6.52:
└─┐
6 │ definition o equals |2024-01-16| - 0 day <= 0 day
│ ‾‾‾‾‾

View File

@ -45,14 +45,14 @@ $ catala Interpret -s Ge
[ERROR]
Cannot compare together durations that cannot be converted to a precise number of days
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:40.23-40.30:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:40.23-40.30:
└──┐
40 │ definition d equals 1 month >= 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `>=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:40.34-40.39:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:40.34-40.39:
└──┐
40 │ definition d equals 1 month >= 2 day
│ ‾‾‾‾‾
@ -66,14 +66,14 @@ $ catala Interpret -s Gt
[ERROR]
Cannot compare together durations that cannot be converted to a precise number of days
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:30.23-30.30:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:30.23-30.30:
└──┐
30 │ definition d equals 1 month > 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:30.33-30.38:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:30.33-30.38:
└──┐
30 │ definition d equals 1 month > 2 day
│ ‾‾‾‾‾
@ -87,14 +87,14 @@ $ catala Interpret -s Le
[ERROR]
Cannot compare together durations that cannot be converted to a precise number of days
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:20.23-20.30:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:20.23-20.30:
└──┐
20 │ definition d equals 1 month <= 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:20.34-20.39:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:20.34-20.39:
└──┐
20 │ definition d equals 1 month <= 2 day
│ ‾‾‾‾‾
@ -108,14 +108,14 @@ $ catala Interpret -s Lt
[ERROR]
Cannot compare together durations that cannot be converted to a precise number of days
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:10.23-10.30:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:10.23-10.30:
└──┐
10 │ definition d equals 1 month < 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:10.33-10.38:
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:10.33-10.38:
└──┐
10 │ definition d equals 1 month < 2 day
│ ‾‾‾‾‾

View File

@ -0,0 +1,18 @@
## Article
```catala
declaration scope A:
output x content integer
scope A:
definition x under condition true consequence equals 1
definition x under condition true consequence equals 0
```
```catala-test-inline
$ catala Interpret -s A --message=gnu
tests/default/bad/conflict.catala_en:8.56-8.57: [ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
tests/default/bad/conflict.catala_en:8.56-8.57: [ERROR] This consequence has a valid justification:
tests/default/bad/conflict.catala_en:9.56-9.57: [ERROR] This consequence has a valid justification:
#return code 123#
```

View File

@ -13,7 +13,7 @@ scope A:
$ catala Interpret -s A
[WARNING] In scope "A", the variable "y" is declared but never defined; did you forget something?
┌─⯈ tests/test_default/bad/empty.catala_en:6.10-6.11:
┌─⯈ tests/default/bad/empty.catala_en:6.10-6.11:
└─┐
6 │ output y content boolean
│ ‾
@ -22,7 +22,7 @@ $ catala Interpret -s A
This variable evaluated to an empty term (no rule that defined it applied in this situation):
error_empty ⟨false ⊢ ∅⟩
┌─⯈ tests/test_default/bad/empty.catala_en:6.10-6.11:
┌─⯈ tests/default/bad/empty.catala_en:6.10-6.11:
└─┐
6 │ output y content boolean
│ ‾

View File

@ -19,7 +19,7 @@ This variable evaluated to an empty term (no rule that defined it applied in thi
error_empty
⟨ ⟨ ⟨ ⟨1 = 4 ⊢ ⟨1⟩⟩ | 1 = 3 ⊢ ⟨1⟩ ⟩ | 1 = 2 ⊢ ⟨1⟩ ⟩ | false ⊢ ∅ ⟩
┌─⯈ tests/test_default/bad/empty_with_rules.catala_en:5.10-5.11:
┌─⯈ tests/default/bad/empty_with_rules.catala_en:5.10-5.11:
└─┐
5 │ output x content integer
│ ‾

View File

@ -21,13 +21,13 @@ or "under condition",
or "."
Error token:
┌─⯈ tests/test_default/bad/typing_or_logical_error.catala_en:8.30-8.31:
┌─⯈ tests/default/bad/typing_or_logical_error.catala_en:8.30-8.31:
└─┐
8 │ definition wrong_definition = 1
│ ‾
Last good token:
┌─⯈ tests/test_default/bad/typing_or_logical_error.catala_en:8.13-8.29:
┌─⯈ tests/default/bad/typing_or_logical_error.catala_en:8.13-8.29:
└─┐
8 │ definition wrong_definition = 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -15,12 +15,12 @@ scope A:
$ catala Typecheck --check-invariants
[WARNING] These definitions have identical justifications and consequences; is it a mistake?
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:9.3-9.15:
┌─⯈ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
└─┐
9 │ definition w equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:6.3-6.15:
┌─⯈ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
└─┐
6 │ definition w equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾
@ -32,12 +32,12 @@ $ catala Typecheck --check-invariants
$ catala Interpret -s A
[WARNING] These definitions have identical justifications and consequences; is it a mistake?
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:9.3-9.15:
┌─⯈ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
└─┐
9 │ definition w equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:6.3-6.15:
┌─⯈ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
└─┐
6 │ definition w equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -19,7 +19,7 @@ $ catala Interpret -s A
[ERROR]
This constructor name is ambiguous, it can belong to E or F. Desambiguate it by prefixing it with the enum name.
┌─⯈ tests/test_enum/bad/ambiguous_cases.catala_en:14.23-14.28:
┌─⯈ tests/enum/bad/ambiguous_cases.catala_en:14.23-14.28:
└──┐
14 │ definition e equals Case1
│ ‾‾‾‾‾

View File

@ -20,7 +20,7 @@ $ catala Interpret -s A
[ERROR]
Couldn't infer the enumeration name from lonely wildcard (wildcard cannot be used as single match case)
┌─⯈ tests/test_enum/bad/ambiguous_wildcard.catala_en:15.5-15.21:
┌─⯈ tests/enum/bad/ambiguous_wildcard.catala_en:15.5-15.21:
└──┐
15 │ -- anything : 31
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -23,13 +23,13 @@ $ catala Interpret -s A
[ERROR]
The constructor Case3 has been matched twice:
┌─⯈ tests/test_enum/bad/duplicate_case.catala_en:18.16-18.20:
┌─⯈ tests/enum/bad/duplicate_case.catala_en:18.16-18.20:
└──┐
18 │ -- Case3 : true
│ ‾‾‾‾
└─ Article
┌─⯈ tests/test_enum/bad/duplicate_case.catala_en:17.16-17.21:
┌─⯈ tests/enum/bad/duplicate_case.catala_en:17.16-17.21:
└──┐
17 │ -- Case3 : false
│ ‾‾‾‾‾

View File

@ -12,7 +12,7 @@ $ catala Typecheck
[ERROR]
The enum Foo does not have any cases; give it some for Catala to be able to accept it.
┌─⯈ tests/test_enum/bad/empty.catala_en:4.25-4.28:
┌─⯈ tests/enum/bad/empty.catala_en:4.25-4.28:
└─┐
4 │ declaration enumeration Foo:
│ ‾‾‾

View File

@ -20,7 +20,7 @@ scope A:
$ catala Interpret -s A
[WARNING] The constructor "Case3" of enumeration "E" is never used; maybe it's unnecessary?
┌─⯈ tests/test_enum/bad/missing_case.catala_en:7.6-7.11:
┌─⯈ tests/enum/bad/missing_case.catala_en:7.6-7.11:
└─┐
7 │ -- Case3
│ ‾‾‾‾‾
@ -28,7 +28,7 @@ $ catala Interpret -s A
[ERROR]
The constructor Case3 of enum E is missing from this pattern matching
┌─⯈ tests/test_enum/bad/missing_case.catala_en:14.25-16.22:
┌─⯈ tests/enum/bad/missing_case.catala_en:14.25-16.22:
└──┐
14 │ definition out equals match e with pattern
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -42,7 +42,7 @@ $ catala Interpret -s First_case
Wildcard must be the last match case
Not ending wildcard:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
└──┐
19 │ -- anything : 31
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -50,7 +50,7 @@ Not ending wildcard:
└─ Wildcard can't be the first case
Next reachable case:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
└──┐
20 │ -- Case2 : 42
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -65,7 +65,7 @@ $ catala Interpret -s Middle_case
Wildcard must be the last match case
Not ending wildcard:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
└──┐
19 │ -- anything : 31
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -73,7 +73,7 @@ Not ending wildcard:
└─ Wildcard can't be the first case
Next reachable case:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
└──┐
20 │ -- Case2 : 42
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -36,21 +36,21 @@ Error during typechecking, incompatible types:
└─⯈ F
While typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:28.23-28.24:
┌─⯈ tests/enum/bad/quick_pattern_2.catala_en:28.23-28.24:
└──┐
28 │ definition y equals x with pattern Case3
│ ‾
└─ Article
Type E is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:17.21-17.22:
┌─⯈ tests/enum/bad/quick_pattern_2.catala_en:17.21-17.22:
└──┐
17 │ context x content E
│ ‾
└─ Article
Type F is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:28.23-28.43:
┌─⯈ tests/enum/bad/quick_pattern_2.catala_en:28.23-28.43:
└──┐
28 │ definition y equals x with pattern Case3
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -26,21 +26,21 @@ Error during typechecking, incompatible types:
└─⯈ F
While typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:18.21-18.22:
┌─⯈ tests/enum/bad/quick_pattern_3.catala_en:18.21-18.22:
└──┐
18 │ definition y equals x with pattern Case3
│ ‾
└─ Article
Type E is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:13.19-13.20:
┌─⯈ tests/enum/bad/quick_pattern_3.catala_en:13.19-13.20:
└──┐
13 │ context x content E
│ ‾
└─ Article
Type F is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:18.21-18.41:
┌─⯈ tests/enum/bad/quick_pattern_3.catala_en:18.21-18.41:
└──┐
18 │ definition y equals x with pattern Case3
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -25,21 +25,21 @@ Error during typechecking, incompatible types:
└─⯈ F
While typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:17.21-17.22:
┌─⯈ tests/enum/bad/quick_pattern_4.catala_en:17.21-17.22:
└──┐
17 │ definition y equals x with pattern Case3
│ ‾
└─ Test
Type E is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:12.19-12.20:
┌─⯈ tests/enum/bad/quick_pattern_4.catala_en:12.19-12.20:
└──┐
12 │ context x content E
│ ‾
└─ Test
Type F is coming from:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:17.21-17.41:
┌─⯈ tests/enum/bad/quick_pattern_4.catala_en:17.21-17.41:
└──┐
17 │ definition y equals x with pattern Case3
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -22,7 +22,7 @@ The name of this constructor has not been defined before
(it's probably a typographical error).
Here is your code :
┌─⯈ tests/test_enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
┌─⯈ tests/enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
└──┐
15 │ definition y equals x with pattern Case3
│ ‾‾‾‾‾

View File

@ -26,7 +26,7 @@ $ catala Interpret -s A
[ERROR]
This case matches a constructor of enumeration E but previous case were matching constructors of enumeration F
┌─⯈ tests/test_enum/bad/too_many_cases.catala_en:21.8-21.13:
┌─⯈ tests/enum/bad/too_many_cases.catala_en:21.8-21.13:
└──┐
21 │ -- Case4 : true
│ ‾‾‾‾‾

View File

@ -21,7 +21,7 @@ scope A:
$ catala Interpret -s A
[WARNING] Unreachable match case, all constructors of the enumeration E are already specified
┌─⯈ tests/test_enum/bad/useless_wildcard.catala_en:17.5-17.21:
┌─⯈ tests/enum/bad/useless_wildcard.catala_en:17.5-17.21:
└──┐
17 │ -- anything : 31
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -18,7 +18,7 @@ The name of this constructor has not been defined before
(it's probably a typographical error).
Here is your code :
┌─⯈ tests/test_enum/bad/wrong_cons.catala_en:11.23-11.28:
┌─⯈ tests/enum/bad/wrong_cons.catala_en:11.23-11.28:
└──┐
11 │ definition e equals Case2
│ ‾‾‾‾‾

View File

@ -19,7 +19,7 @@ $ catala Interpret -s A
This exception can refer to several definitions. Try using labels to disambiguate
Ambiguous exception
┌─⯈ tests/test_exception/bad/ambiguous_unlabeled_exception.catala_en:12.3-13.15:
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:12.3-13.15:
└──┐
12 │ exception
│ ‾‾‾‾‾‾‾‾‾
@ -28,14 +28,14 @@ Ambiguous exception
└─ Test
Candidate definition
┌─⯈ tests/test_exception/bad/ambiguous_unlabeled_exception.catala_en:10.14-10.15:
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:10.14-10.15:
└──┐
10 │ definition x equals 1
│ ‾
└─ Test
Candidate definition
┌─⯈ tests/test_exception/bad/ambiguous_unlabeled_exception.catala_en:8.14-8.15:
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:8.14-8.15:
└─┐
8 │ definition x equals 0
│ ‾

View File

@ -18,7 +18,7 @@ $ catala Interpret -s A
[ERROR]
Unknown label for the scope variable x: "base_y"
┌─⯈ tests/test_exception/bad/dangling_exception.catala_en:12.13-12.19:
┌─⯈ tests/exception/bad/dangling_exception.catala_en:12.13-12.19:
└──┐
12 │ exception base_y
│ ‾‾‾‾‾‾

View File

@ -23,7 +23,7 @@ $ catala Interpret -s A
[ERROR]
Exception cycle detected when defining x: each of these 3 exceptions applies over the previous one, and the first applies over the last
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:8.3-10.15:
┌─⯈ tests/exception/bad/exceptions_cycle.catala_en:8.3-10.15:
└──┐
8 │ label base_x
│ ‾‾‾‾‾‾‾‾‾‾‾‾
@ -32,7 +32,7 @@ Exception cycle detected when defining x: each of these 3 exceptions applies ove
10 │ definition x equals 0
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:12.3-14.15:
┌─⯈ tests/exception/bad/exceptions_cycle.catala_en:12.3-14.15:
└──┐
12 │ label exception_x
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -41,7 +41,7 @@ Exception cycle detected when defining x: each of these 3 exceptions applies ove
14 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:16.3-18.15:
┌─⯈ tests/exception/bad/exceptions_cycle.catala_en:16.3-18.15:
└──┐
16 │ label exception_exception_x
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -14,7 +14,7 @@ $ catala Interpret -s A
[ERROR]
This exception does not have a corresponding definition
┌─⯈ tests/test_exception/bad/missing_unlabeled_definition.catala_en:8.3-9.15:
┌─⯈ tests/exception/bad/missing_unlabeled_definition.catala_en:8.3-9.15:
└─┐
8 │ exception
│ ‾‾‾‾‾‾‾‾‾

View File

@ -25,7 +25,7 @@ $ catala Interpret -s A
This exception can refer to several definitions. Try using labels to disambiguate
Ambiguous exception
┌─⯈ tests/test_exception/bad/one_ambiguous_exception.catala_en:18.3-19.15:
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:18.3-19.15:
└──┐
18 │ exception
│ ‾‾‾‾‾‾‾‾‾
@ -34,14 +34,14 @@ Ambiguous exception
└─ Test
Candidate definition
┌─⯈ tests/test_exception/bad/one_ambiguous_exception.catala_en:16.14-16.15:
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:16.14-16.15:
└──┐
16 │ definition y equals 4
│ ‾
└─ Test
Candidate definition
┌─⯈ tests/test_exception/bad/one_ambiguous_exception.catala_en:14.14-14.15:
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:14.14-14.15:
└──┐
14 │ definition y equals 2
│ ‾

View File

@ -15,7 +15,7 @@ $ catala Interpret -s A
[ERROR]
Cannot define rule as an exception to itself
┌─⯈ tests/test_exception/bad/self_exception.catala_en:9.13-9.19:
┌─⯈ tests/exception/bad/self_exception.catala_en:9.13-9.19:
└─┐
9 │ exception base_y
│ ‾‾‾‾‾‾

View File

@ -21,14 +21,14 @@ $ catala Interpret -s A
There is a conflict between multiple valid consequences for assigning the same variable.
This consequence has a valid justification:
┌─⯈ tests/test_exception/bad/two_exceptions.catala_en:12.23-12.24:
┌─⯈ tests/exception/bad/two_exceptions.catala_en:12.23-12.24:
└──┐
12 │ definition x equals 1
│ ‾
└─ Test
This consequence has a valid justification:
┌─⯈ tests/test_exception/bad/two_exceptions.catala_en:15.23-15.24:
┌─⯈ tests/exception/bad/two_exceptions.catala_en:15.23-15.24:
└──┐
15 │ definition x equals 2
│ ‾

View File

@ -16,13 +16,13 @@ scope Foo:
$ catala Typecheck --check-invariants
[WARNING] These definitions have identical justifications and consequences; is it a mistake?
┌─⯈ tests/test_exception/good/double_definition.catala_en:9.3-9.15:
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
└─┐
9 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Foo
┌─⯈ tests/test_exception/good/double_definition.catala_en:8.3-8.15:
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
└─┐
8 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
@ -35,13 +35,13 @@ $ catala Typecheck --check-invariants
$ catala Scopelang -s Foo
[WARNING] These definitions have identical justifications and consequences; is it a mistake?
┌─⯈ tests/test_exception/good/double_definition.catala_en:9.3-9.15:
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
└─┐
9 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Foo
┌─⯈ tests/test_exception/good/double_definition.catala_en:8.3-8.15:
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
└─┐
8 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
@ -60,13 +60,13 @@ Dcalc translation below.
$ catala Dcalc -s Foo
[WARNING] These definitions have identical justifications and consequences; is it a mistake?
┌─⯈ tests/test_exception/good/double_definition.catala_en:9.3-9.15:
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
└─┐
9 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Foo
┌─⯈ tests/test_exception/good/double_definition.catala_en:8.3-8.15:
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
└─┐
8 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -84,36 +84,36 @@ $ catala Exceptions -s Foo -v x
Printing the tree of exceptions for the definitions of variable "x" of scope "Foo".
[RESULT]
Definitions with label "base":
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:9.3-9.26:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:9.3-9.26:
└─┐
9 │ label base definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:13.3-13.26:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:13.3-13.26:
└──┐
13 │ label base definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
[RESULT]
Definitions with label "intermediate":
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:17.3-17.49:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:17.3-17.49:
└──┐
17 │ label intermediate exception base definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:21.3-21.49:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:21.3-21.49:
└──┐
21 │ label intermediate exception base definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
[RESULT]
Definitions with label "exception_to_intermediate":
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:25.3-25.38:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:25.3-25.38:
└──┐
25 │ exception intermediate definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
┌─⯈ tests/test_exception/good/groups_of_exceptions.catala_en:29.3-29.38:
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:29.3-29.38:
└──┐
29 │ exception intermediate definition x under condition
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -33,14 +33,14 @@ $ catala Interpret -s S
There is a conflict between multiple valid consequences for assigning the same variable.
This consequence has a valid justification:
┌─⯈ tests/test_func/bad/bad_func.catala_en:14.65-14.70:
┌─⯈ tests/func/bad/bad_func.catala_en:14.65-14.70:
└──┐
14 │ definition f of x under condition (x >= x) consequence equals x + x
│ ‾‾‾‾‾
└─ Article
This consequence has a valid justification:
┌─⯈ tests/test_func/bad/bad_func.catala_en:15.62-15.67:
┌─⯈ tests/func/bad/bad_func.catala_en:15.62-15.67:
└──┐
15 │ definition f of x under condition not b consequence equals x * x
│ ‾‾‾‾‾

View File

@ -18,13 +18,13 @@ $ catala typecheck
Function argument name mismatch between declaration ('x') and definition ('y')
Argument declared here:
┌─⯈ tests/test_func/bad/param_inconsistency.catala_en:4.42-4.43:
┌─⯈ tests/func/bad/param_inconsistency.catala_en:4.42-4.43:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency.catala_en:10.20-10.21:
┌─⯈ tests/func/bad/param_inconsistency.catala_en:10.20-10.21:
└──┐
10 │ definition f1 of y under condition not cond
│ ‾

View File

@ -17,13 +17,13 @@ $ catala typecheck
Function argument name mismatch between declaration ('x') and definition ('y')
Argument declared here:
┌─⯈ tests/test_func/bad/param_inconsistency2.catala_en:4.42-4.43:
┌─⯈ tests/func/bad/param_inconsistency2.catala_en:4.42-4.43:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency2.catala_en:9.30-9.31:
┌─⯈ tests/func/bad/param_inconsistency2.catala_en:9.30-9.31:
└─┐
9 │ exception definition f1 of y under condition not cond
│ ‾

View File

@ -17,13 +17,13 @@ $ catala typecheck
Function argument name mismatch between declaration ('x') and definition ('y')
Argument declared here:
┌─⯈ tests/test_func/bad/param_inconsistency3.catala_en:4.42-4.43:
┌─⯈ tests/func/bad/param_inconsistency3.catala_en:4.42-4.43:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency3.catala_en:9.30-9.31:
┌─⯈ tests/func/bad/param_inconsistency3.catala_en:9.30-9.31:
└─┐
9 │ exception definition f1 of y under condition not cond
│ ‾

View File

@ -13,7 +13,7 @@ $ catala Interpret -s RecursiveFunc
[ERROR]
The variable f is used in one of its definitions, but recursion is forbidden in Catala
┌─⯈ tests/test_func/bad/recursive.catala_en:8.28-8.29:
┌─⯈ tests/func/bad/recursive.catala_en:8.28-8.29:
└─┐
8 │ definition f of x equals f of x + 1
│ ‾

View File

@ -20,14 +20,14 @@ $ catala Typecheck
This subscope variable is a mandatory input but no definition was provided.
Incriminated subscope:
┌─⯈ tests/test_io/bad/forgot_input.catala_en:9.3-9.4:
┌─⯈ tests/io/bad/forgot_input.catala_en:9.3-9.4:
└─┐
9 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_io/bad/forgot_input.catala_en:6.9-6.10:
┌─⯈ tests/io/bad/forgot_input.catala_en:6.9-6.10:
└─┐
6 │ input x content integer
│ ‾

Some files were not shown because too many files have changed in this diff Show More