With @aminata-dev update Messages.Content

This commit is contained in:
Denis Merigoux 2023-06-19 17:08:16 +02:00 committed by Louis Gesbert
parent 4cdd2fce0f
commit 50113586e3
89 changed files with 233 additions and 401 deletions

View File

@ -957,7 +957,7 @@ let driver
| _ -> Message.raise_error "The command \"%s\" is unknown to clerk." command
with Message.CompilerError content ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content content Error;
Message.Content.emit content Error;
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
return_err

View File

@ -116,96 +116,76 @@ let pp_marker target ppf =
module Content = struct
type message = Format.formatter -> unit
type position = { pos_message : message option; pos : Pos.t }
type suggestions = string list option
type t = {
message : message;
positions : position list;
suggestions : suggestions;
}
type message_element =
| MainMessage of message
| Position of position
| Suggestion of message
| Result of message
let of_message (message : message) : t =
{ message; positions = []; suggestions = None }
type t = message_element list
let of_message (message : message) : t = [MainMessage message]
let of_result (message : message) : t = [Result message]
let prepend_message (content : t) prefix : t = MainMessage prefix :: content
let to_internal_error (content : t) : t =
let internal_error_prefix ppf =
Format.pp_print_string ppf
"Internal Error, please report to \
https://github.com/CatalaLang/catala/issues."
in
prepend_message content internal_error_prefix
let add_suggestion (content : t) (suggestion : message) =
content @ [Suggestion suggestion]
let of_string (s : string) : t =
{
message = (fun ppf -> Format.pp_print_string ppf s);
positions = [];
suggestions = None;
}
[MainMessage (fun ppf -> Format.pp_print_string ppf s)]
let internal_error_prefix =
"Internal Error, please report to \
https://github.com/CatalaLang/catala/issues: "
let prepend_message (content : t) prefix : t =
{
content with
message = (fun ppf -> Format.fprintf ppf "%t@,%t" prefix content.message);
}
let mark_as_internal_error (content : t) : t =
{
content with
message =
(fun ppf ->
Format.fprintf ppf "%s@,%t" internal_error_prefix content.message);
}
let emit (content : t) (target : content_type) : unit =
match Cli.globals.message_format with
| Cli.Human ->
let ppf = get_ppf target in
Format.fprintf ppf "@[<hv>%t%t%a@]@." (pp_marker target)
(fun (ppf : Format.formatter) ->
match content, target with
| MainMessage _ :: _, (Result | Error) -> Format.pp_print_space ppf ()
| _ -> Format.pp_print_char ppf ' ')
(fun (ppf : Format.formatter) (message_elements : t) ->
Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt "@.")
(fun ppf (elt : message_element) ->
match elt with
| Position pos ->
Option.iter
(fun msg -> Format.fprintf ppf "%t@." msg)
pos.pos_message;
Pos.format_loc_text ppf pos.pos
| MainMessage msg -> msg ppf
| Result msg -> msg ppf
| Suggestion msg ->
Format.fprintf ppf "Maybe you wanted to write %t" msg)
ppf message_elements)
content
| Cli.GNU -> failwith "unimplemented until the message library stabilises"
(* (* The top message doesn't come with a position, which is not something the
GNU standard allows. So we look the position list and put the top message
everywhere there is not a more precise message. If we can't find a position
without a more precise message, we just take the first position in the list
to pair with the message. *) let ppf = get_ppf target in let () = if
positions != [] && List.for_all (fun (pos' : Content.position) ->
Option.is_some pos'.pos_message) positions then Format.fprintf ppf
"@{<blue>%s@}: %t %s@\n" (Pos.to_string_short (List.hd positions).pos)
(pp_marker target) (unformat message) in Format.pp_print_list
~pp_sep:Format.pp_print_newline (fun ppf pos' -> Format.fprintf ppf
"@{<blue>%s@}: %t %s" (Pos.to_string_short pos'.pos) (pp_marker target)
(match pos'.pos_message with | None -> unformat message | Some msg' ->
unformat msg')) ppf positions *)
end
open Content
let emit_content (content : Content.t) (target : content_type) : unit =
let { message; positions; suggestions } = content in
match Cli.globals.message_format with
| Cli.Human ->
let ppf = get_ppf target in
Format.fprintf ppf "@[<v>@[<hov 0>%t%t%t@]%a@]@." (pp_marker target)
(fun ppf ->
match target with
| Log | Error | Warning | Debug -> Format.pp_print_char ppf ' '
| Result -> Format.pp_print_space ppf ())
message
(fun ppf l ->
Format.pp_print_list
~pp_sep:(fun _ () -> ())
(fun ppf pos ->
Format.pp_print_cut ppf ();
Format.pp_print_cut ppf ();
Option.iter
(fun msg -> Format.fprintf ppf "%t@," msg)
pos.pos_message;
Pos.format_loc_text ppf pos.pos)
ppf l)
positions
| Cli.GNU ->
(* The top message doesn't come with a position, which is not something the
GNU standard allows. So we look the position list and put the top message
everywhere there is not a more precise message. If we can't find a
position without a more precise message, we just take the first position
in the list to pair with the message. *)
let ppf = get_ppf target in
let () =
if
positions != []
&& List.for_all
(fun (pos' : Content.position) -> Option.is_some pos'.pos_message)
positions
then
Format.fprintf ppf "@{<blue>%s@}: %t %s@\n"
(Pos.to_string_short (List.hd positions).pos)
(pp_marker target) (unformat message)
in
Format.pp_print_list ~pp_sep:Format.pp_print_newline
(fun ppf pos' ->
Format.fprintf ppf "@{<blue>%s@}: %t %s"
(Pos.to_string_short pos'.pos)
(pp_marker target)
(match pos'.pos_message with
| None -> unformat message
| Some msg' -> unformat msg'))
ppf positions
(** {1 Error exception} *)
exception CompilerError of Content.t
@ -214,18 +194,18 @@ exception CompilerError of Content.t
let raise_spanned_error
?(span_msg : Content.message option)
?(suggestion : Content.message option)
(span : Pos.t)
?(suggestions : string list option)
format =
Format.kdprintf
(fun message ->
raise
(CompilerError
{
message;
positions = [{ pos_message = span_msg; pos = span }];
suggestions;
}))
([
MainMessage message;
Position { pos_message = span_msg; pos = span };
]
@ match suggestion with None -> [] | Some sug -> [Suggestion sug])))
format
let raise_multispanned_error_full
@ -235,12 +215,10 @@ let raise_multispanned_error_full
(fun message ->
raise
(CompilerError
{
message;
positions =
List.map (fun (pos_message, pos) -> { pos_message; pos }) spans;
suggestions = None;
}))
(MainMessage message
:: List.map
(fun (pos_message, pos) -> Position { pos_message; pos })
spans)))
format
let raise_multispanned_error spans format =
@ -253,12 +231,14 @@ let raise_multispanned_error spans format =
let raise_error format =
Format.kdprintf
(fun message ->
raise (CompilerError { message; positions = []; suggestions = None }))
(fun message -> raise (CompilerError [MainMessage message]))
format
let raise_internal_error format =
raise_error ("%s" ^^ format) internal_error_prefix
Format.kdprintf
(fun message ->
raise (CompilerError (Content.to_internal_error [MainMessage message])))
format
(** {1 Warning printing}*)
@ -271,13 +251,11 @@ let emit_multispanned_warning
format =
Format.kdprintf
(fun message ->
emit_content
{
message;
positions =
List.map (fun (pos_message, pos) -> { pos_message; pos }) pos;
suggestions = None;
}
Content.emit
(MainMessage message
:: List.map
(fun (pos_message, pos) -> Position { pos_message; pos })
pos)
Warning)
format
@ -290,19 +268,14 @@ let emit_spanned_warning
let emit_warning format = emit_multispanned_warning [] format
let emit_log format =
Format.kdprintf
(fun message ->
emit_content { message; positions = []; suggestions = None } Log)
format
Format.kdprintf (fun message -> Content.emit [MainMessage message] Log) format
let emit_debug format =
Format.kdprintf
(fun message ->
emit_content { message; positions = []; suggestions = None } Debug)
(fun message -> Content.emit [MainMessage message] Debug)
format
let emit_result format =
Format.kdprintf
(fun message ->
emit_content { message; positions = []; suggestions = None } Result)
(fun message -> Content.emit [MainMessage message] Result)
format

View File

@ -27,21 +27,35 @@
(** {1 Message content} *)
module Content : sig
type message = Format.formatter -> unit
type position = { pos_message : message option; pos : Pos.t }
type suggestions = string list option
type t
val of_message : (Format.formatter -> unit) -> t
val of_string : string -> t
val mark_as_internal_error : t -> t
val prepend_message : t -> (Format.formatter -> unit) -> t
end
type content_type = Error | Warning | Debug | Log | Result
val emit_content : Content.t -> content_type -> unit
module Content : sig
(** {2 Types}*)
type message = Format.formatter -> unit
type t
(** {2 Content creation}*)
val of_message : message -> t
val of_result : message -> t
(** Similar as [of_message] but tailored for when you want to print the result
of a value, etc. *)
val of_string : string -> t
val prepend_message : t -> (Format.formatter -> unit) -> t
(** {2 Content manipulation}*)
val to_internal_error : t -> t
val add_suggestion : t -> message -> t
(** {2 Content emission}*)
val emit : t -> content_type -> unit
end
(** This functions emits the message according to the emission type defined by
[Cli.message_format_flag]. *)
@ -53,8 +67,8 @@ exception CompilerError of Content.t
val raise_spanned_error :
?span_msg:Content.message ->
?suggestion:Content.message ->
Pos.t ->
?suggestions:string list ->
('a, Format.formatter, unit, 'b) format4 ->
'a

View File

@ -124,7 +124,7 @@ module Passes = struct
let bt = Printexc.get_raw_backtrace () in
Printexc.raise_with_backtrace
(Message.CompilerError
(Message.Content.mark_as_internal_error error_content))
(Message.Content.to_internal_error error_content))
bt
in
if check_invariants then (
@ -883,19 +883,19 @@ let main () =
| exception Cli.Exit_with n -> exit n
| exception Message.CompilerError content ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content content Error;
Message.Content.emit content Error;
if Cli.globals.debug then Printexc.print_raw_backtrace stderr bt;
exit Cmd.Exit.some_error
| exception Sys_error msg ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content
Message.Content.emit
(Message.Content.of_string ("System error: " ^ msg))
Error;
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
exit Cmd.Exit.internal_error
| exception e ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content
Message.Content.emit
(Message.Content.of_string ("Unexpected error: " ^ Printexc.to_string e))
Error;
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;

View File

@ -28,17 +28,16 @@ scope Test1:
```catala-test-inline
$ catala Interpret -s Test1
[ERROR] Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
[ERROR]
Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
Error token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
└──┐
11 │ context my_gaming scope GamingAuthorized
│ ‾‾‾‾‾
Last good token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
└──┐
@ -72,17 +71,16 @@ scope Test2:
```
```catala-test-inline
$ catala Interpret -s Test2
[ERROR] Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
[ERROR]
Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
Error token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
└──┐
11 │ context my_gaming scope GamingAuthorized
│ ‾‾‾‾‾
Last good token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
└──┐
@ -116,17 +114,16 @@ scope Test3:
```
```catala-test-inline
$ catala Interpret -s Test3
[ERROR] Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
[ERROR]
Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
Error token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
└──┐
11 │ context my_gaming scope GamingAuthorized
│ ‾‾‾‾‾
Last good token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
└──┐
@ -162,17 +159,16 @@ scope Test4:
```catala-test-inline
$ catala Interpret -s Test4
[ERROR] Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
[ERROR]
Syntax error at token "scope"
Message: expected either 'condition', or 'content' followed by the expected variable type
Autosuggestion: did you mean "content", or maybe "condition"?
Error token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
└──┐
11 │ context my_gaming scope GamingAuthorized
│ ‾‾‾‾‾
Last good token:
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
└──┐

View File

@ -283,7 +283,7 @@ let driver_lwt
Lwt.return 0
with Message.CompilerError content ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content content Error;
Message.Content.emit content Error;
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
Lwt.return (-1)
@ -293,7 +293,7 @@ let driver file debug diff expiration custom_date client_id client_secret =
(driver_lwt file debug diff expiration custom_date client_id client_secret)
with Message.CompilerError content ->
let bt = Printexc.get_raw_backtrace () in
Message.emit_content content Error;
Message.Content.emit content Error;
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
-1

View File

@ -34,7 +34,6 @@ scope Money:
```catala-test-inline
$ catala Interpret -s Dec
[ERROR] division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:20.23-20.30:
└──┐
@ -42,7 +41,6 @@ The division operator:
│ ‾‾‾‾‾‾‾
└┬ `Division_by_zero` exception management
└─ with decimals
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:20.28-20.30:
└──┐
@ -56,7 +54,6 @@ The null denominator:
```catala-test-inline
$ catala Interpret -s Int
[ERROR] division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:10.23-10.28:
└──┐
@ -64,7 +61,6 @@ The division operator:
│ ‾‾‾‾‾
└┬ `Division_by_zero` exception management
└─ with integers
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:10.27-10.28:
└──┐
@ -78,7 +74,6 @@ The null denominator:
```catala-test-inline
$ catala Interpret -s Money
[ERROR] division by zero at runtime
The division operator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:30.23-30.35:
└──┐
@ -86,7 +81,6 @@ The division operator:
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└┬ `Division_by_zero` exception management
└─ with money
The null denominator:
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:30.31-30.35:
└──┐

View File

@ -8,14 +8,13 @@ scope S1:
```catala-test-inline
$ catala typecheck
[ERROR] Please add parentheses to explicit which of these operators should be applied first
[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:
└─┐
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:
└─┐
6 │ definition o equals true and (false and true and true) or false

View File

@ -13,20 +13,17 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] I don't know how to apply operator >= on types integer and money
┌─⯈ tests/test_array/bad/fold_error.catala_en:10.50-10.52:
└──┐
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.35-5.42:
└─┐
5 │ context list content collection integer
│ ‾‾‾‾‾‾‾
└─ Article
Type money coming from expression:
┌─⯈ tests/test_array/bad/fold_error.catala_en:10.53-10.55:
└──┐

View File

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

View File

@ -13,21 +13,18 @@ $ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
┌─⯈ integer
└─⯈ bool
Error coming from typechecking the following expression:
┌─⯈ tests/test_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
Type integer coming from expression:
┌─⯈ tests/test_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
Type bool coming from expression:
┌─⯈ tests/test_bool/bad/test_xor_with_int.catala_en:8.33-8.36:
└─┐

View File

@ -26,13 +26,11 @@ scope Test:
```catala-test-inline
$ 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:
└──┐
10 │ date round decreasing
│ ‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_date/bad/rounding_option_conflict.catala_en:12.14-12.24:
└──┐
12 │ date round increasing

View File

@ -42,15 +42,14 @@ scope Ge:
```catala-test-inline
$ catala Interpret -s Ge
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
[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:
└──┐
40 │ definition d equals 1 month >= 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `>=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:40.34-40.39:
└──┐
40 │ definition d equals 1 month >= 2 day
@ -62,15 +61,14 @@ $ catala Interpret -s Ge
```catala-test-inline
$ catala Interpret -s Gt
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
[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:
└──┐
30 │ definition d equals 1 month > 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:30.33-30.38:
└──┐
30 │ definition d equals 1 month > 2 day
@ -82,15 +80,14 @@ $ catala Interpret -s Gt
```catala-test-inline
$ catala Interpret -s Le
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
[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:
└──┐
20 │ definition d equals 1 month <= 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<=` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:20.34-20.39:
└──┐
20 │ definition d equals 1 month <= 2 day
@ -102,15 +99,14 @@ $ catala Interpret -s Le
```catala-test-inline
$ catala Interpret -s Lt
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
[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:
└──┐
10 │ definition d equals 1 month < 2 day
│ ‾‾‾‾‾‾‾
└┬ `UncomparableDurations` exception management
└─ `<` operator
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:10.33-10.38:
└──┐
10 │ definition d equals 1 month < 2 day

View File

@ -11,15 +11,14 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
[ERROR]
There is a conflict between multiple valid consequences for assigning the same variable.
This consequence has a valid justification:
┌─⯈ tests/test_default/bad/conflict.catala_en:8.56-8.57:
└─┐
8 │ definition x under condition true consequence equals 1
│ ‾
└─ Article
This consequence has a valid justification:
┌─⯈ tests/test_default/bad/conflict.catala_en:9.56-9.57:
└─┐

View File

@ -12,14 +12,13 @@ scope A:
```catala-test-inline
$ 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:
└─┐
6 │ output y content boolean
│ ‾
└─ Article
[ERROR] This variable evaluated to an empty term (no rule that defined it applied in this situation)
[ERROR]
This variable evaluated to an empty term (no rule that defined it applied in this situation)
┌─⯈ tests/test_default/bad/empty.catala_en:6.10-6.11:
└─┐
6 │ output y content boolean

View File

@ -14,8 +14,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] This variable evaluated to an empty term (no rule that defined it applied in this situation)
[ERROR]
This variable evaluated to an empty term (no rule that defined it applied in this situation)
┌─⯈ tests/test_default/bad/empty_with_rules.catala_en:5.10-5.11:
└─┐
5 │ output x content integer

View File

@ -12,13 +12,11 @@ scope A:
```catala-test-inline
$ 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:
└─┐
9 │ definition w equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:6.3-6.15:
└─┐
6 │ definition w equals 3

View File

@ -16,8 +16,8 @@ scope A:
```catala-test-inline
$ 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.
[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:
└──┐
14 │ definition e equals Case1

View File

@ -17,8 +17,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] Couldn't infer the enumeration name from lonely wildcard (wildcard cannot be used as single match case)
[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:
└──┐
15 │ -- anything : 31

View File

@ -21,13 +21,11 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] The constructor Case3 has been matched twice:
┌─⯈ tests/test_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:
└──┐
17 │ -- Case3 : false

View File

@ -9,8 +9,8 @@ declaration scope Bar:
```catala-test-inline
$ catala Typecheck
[ERROR] The enum Foo does not have any cases; give it some for Catala to be able to accept it.
[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:
└─┐
4 │ declaration enumeration Foo:

View File

@ -19,14 +19,12 @@ scope A:
```catala-test-inline
$ 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:
└─┐
7 │ -- Case3
│ ‾‾‾‾‾
└─ Article
[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:
└──┐
14 │ definition out equals match e with pattern

View File

@ -39,7 +39,6 @@ scope Middle_case:
```catala-test-inline
$ catala Interpret -s First_case
[ERROR] Wildcard must be the last match case
Not ending wildcard:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
└──┐
@ -47,7 +46,6 @@ Not ending wildcard:
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Wildcard must be the last case
└─ Wildcard can't be the first case
Next reachable case:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
└──┐
@ -61,7 +59,6 @@ Next reachable case:
```catala-test-inline
$ catala Interpret -s Middle_case
[ERROR] Wildcard must be the last match case
Not ending wildcard:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
└──┐
@ -69,7 +66,6 @@ Not ending wildcard:
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
└┬ Wildcard must be the last case
└─ Wildcard can't be the first case
Next reachable case:
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
└──┐

View File

@ -33,21 +33,18 @@ $ catala Interpret -s A
[ERROR] Error during typechecking, incompatible types:
┌─⯈ E
└─⯈ F
Error coming from typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:28.23-28.24:
└──┐
28 │ definition y equals x with pattern Case3
│ ‾
└─ Article
Type E coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:17.21-17.22:
└──┐
17 │ context x content E
│ ‾
└─ Article
Type F coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:28.23-28.43:
└──┐

View File

@ -23,21 +23,18 @@ $ catala Interpret -s A
[ERROR] Error during typechecking, incompatible types:
┌─⯈ E
└─⯈ F
Error coming from typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:18.21-18.22:
└──┐
18 │ definition y equals x with pattern Case3
│ ‾
└─ Article
Type E coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:13.19-13.20:
└──┐
13 │ context x content E
│ ‾
└─ Article
Type F coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:18.21-18.41:
└──┐

View File

@ -22,21 +22,18 @@ $ catala Interpret -s A
[ERROR] Error during typechecking, incompatible types:
┌─⯈ E
└─⯈ F
Error coming from typechecking the following expression:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:17.21-17.22:
└──┐
17 │ definition y equals x with pattern Case3
│ ‾
└─ Test
Type E coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:12.19-12.20:
└──┐
12 │ context x content E
│ ‾
└─ Test
Type F coming from expression:
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:17.21-17.41:
└──┐

View File

@ -17,8 +17,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] The name of this constructor has not been defined before, maybe it is a typo? Maybe you wanted to say "Case1"?
[ERROR]
The name of this constructor has not been defined before, maybe it is a typo? Maybe you wanted to say "Case1"?
┌─⯈ tests/test_enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
└──┐
15 │ definition y equals x with pattern Case3

View File

@ -23,8 +23,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] This case matches a constructor of enumeration E but previous case were matching constructors of enumeration F
[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:
└──┐
21 │ -- Case4 : true

View File

@ -20,7 +20,6 @@ scope A:
```catala-test-inline
$ 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:
└──┐
17 │ -- anything : 31

View File

@ -14,12 +14,12 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] The name of this constructor has not been defined before, maybe it is a typo? Maybe you wanted to say "Case1"?
[ERROR]
The name of this constructor has not been defined before, maybe it is a typo? Maybe you wanted to say "Case1"?
┌─⯈ tests/test_enum/bad/wrong_cons.catala_en:12.23-12.28:
└──┐
12 │ definition e equals Case2
│ ‾‾‾‾‾
└─ Article
#return code 255#
#return code 123#
```

View File

@ -15,8 +15,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] This exception can refer to several definitions. Try using labels to disambiguate
[ERROR]
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:
└──┐
@ -25,14 +25,12 @@ Ambiguous exception
13 │ definition x equals 2
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
Candidate definition
┌─⯈ tests/test_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:
└─┐

View File

@ -16,7 +16,6 @@ scope A:
```catala-test-inline
$ 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:
└──┐
12 │ exception base_y

View File

@ -20,8 +20,8 @@ scope A:
```catala-test-inline
$ 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
[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:
└──┐
8 │ label base_x
@ -31,7 +31,6 @@ $ catala Interpret -s A
10 │ definition x equals 0
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:12.3-14.15:
└──┐
12 │ label exception_x
@ -41,7 +40,6 @@ $ catala Interpret -s A
14 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:16.3-18.15:
└──┐
16 │ label exception_exception_x

View File

@ -12,7 +12,6 @@ scope A:
```catala-test-inline
$ 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:
└─┐
8 │ exception

View File

@ -21,8 +21,8 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] This exception can refer to several definitions. Try using labels to disambiguate
[ERROR]
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:
└──┐
@ -31,14 +31,12 @@ Ambiguous exception
19 │ definition y equals 3
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Test
Candidate definition
┌─⯈ tests/test_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:
└──┐

View File

@ -13,7 +13,6 @@ scope A:
```catala-test-inline
$ 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:
└─┐
9 │ exception base_y

View File

@ -17,15 +17,14 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
[ERROR]
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:
└──┐
12 │ definition x equals 1
│ ‾
└─ Test
This consequence has a valid justification:
┌─⯈ tests/test_exception/bad/two_exceptions.catala_en:15.23-15.24:
└──┐

View File

@ -13,13 +13,11 @@ scope Foo:
```catala-test-inline
$ 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:
└─┐
9 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Foo
┌─⯈ tests/test_exception/good/double_definition.catala_en:8.3-8.15:
└─┐
8 │ definition x equals 1
@ -38,13 +36,11 @@ Dcalc translation below.
```catala-test-inline
$ 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:
└─┐
9 │ definition x equals 1
│ ‾‾‾‾‾‾‾‾‾‾‾‾
└─ Foo
┌─⯈ tests/test_exception/good/double_definition.catala_en:8.3-8.15:
└─┐
8 │ definition x equals 1

View File

@ -29,15 +29,14 @@ $ catala Interpret -s R
```catala-test-inline
$ catala Interpret -s S
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
[ERROR]
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:
└──┐
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:
└──┐

View File

@ -14,15 +14,14 @@ scope S:
```catala-test-inline
$ catala typecheck
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
[ERROR]
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:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency.catala_en:10.20-10.21:
└──┐

View File

@ -13,15 +13,14 @@ scope S:
```catala-test-inline
$ catala typecheck
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
[ERROR]
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:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency2.catala_en:9.30-9.31:
└─┐

View File

@ -13,15 +13,14 @@ scope S:
```catala-test-inline
$ catala typecheck
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
[ERROR]
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:
└─┐
4 │ internal f1 content decimal depends on x content integer
│ ‾
Defined here:
┌─⯈ tests/test_func/bad/param_inconsistency3.catala_en:9.30-9.31:
└─┐

View File

@ -10,8 +10,8 @@ scope RecursiveFunc:
```catala-test-inline
$ catala Interpret -s RecursiveFunc
[ERROR] The variable f is used in one of its definitions, but recursion is forbidden in Catala
[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:
└─┐
8 │ definition f of x equals f of x + 1

View File

@ -17,22 +17,20 @@ scope B:
```catala-test-inline
$ catala Scopelang -s B
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
[ERROR]
It is impossible to give a definition to a subscope variable not tagged as input or context.
Incriminated subscope:
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
└─┐
9 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_func/good/context_func.catala_en:5.10-5.11:
└─┐
5 │ output f content integer depends on x content integer
│ ‾
└─ Test
Incriminated subscope variable definition:
┌─⯈ tests/test_func/good/context_func.catala_en:15.3-15.17:
└──┐
@ -44,22 +42,20 @@ Incriminated subscope variable definition:
```catala-test-inline
$ catala Dcalc -s A
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
[ERROR]
It is impossible to give a definition to a subscope variable not tagged as input or context.
Incriminated subscope:
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
└─┐
9 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_func/good/context_func.catala_en:5.10-5.11:
└─┐
5 │ output f content integer depends on x content integer
│ ‾
└─ Test
Incriminated subscope variable definition:
┌─⯈ tests/test_func/good/context_func.catala_en:15.3-15.17:
└──┐
@ -71,22 +67,20 @@ Incriminated subscope variable definition:
```catala-test-inline
$ catala Dcalc -s B
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
[ERROR]
It is impossible to give a definition to a subscope variable not tagged as input or context.
Incriminated subscope:
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
└─┐
9 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_func/good/context_func.catala_en:5.10-5.11:
└─┐
5 │ output f content integer depends on x content integer
│ ‾
└─ Test
Incriminated subscope variable definition:
┌─⯈ tests/test_func/good/context_func.catala_en:15.3-15.17:
└──┐

View File

@ -16,15 +16,14 @@ scope B:
```
```catala-test-inline
$ catala Typecheck
[ERROR] This subscope variable is a mandatory input but no definition was provided.
[ERROR]
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:
└─┐
9 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_io/bad/forgot_input.catala_en:6.9-6.10:
└─┐

View File

@ -16,22 +16,20 @@ scope B:
```
```catala-test-inline
$ catala Typecheck
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
[ERROR]
It is impossible to give a definition to a subscope variable not tagged as input or context.
Incriminated subscope:
┌─⯈ tests/test_io/bad/inputing_to_not_input.catala_en:8.3-8.4:
└─┐
8 │ a scope A
│ ‾
└─ Test
Incriminated variable:
┌─⯈ tests/test_io/bad/inputing_to_not_input.catala_en:5.10-5.11:
└─┐
5 │ output a content integer
│ ‾
└─ Test
Incriminated subscope variable definition:
┌─⯈ tests/test_io/bad/inputing_to_not_input.catala_en:14.3-14.17:
└──┐

View File

@ -9,15 +9,14 @@ scope A:
```
```catala-test-inline
$ catala Typecheck
[ERROR] It is impossible to give a definition to a scope variable tagged as input.
[ERROR]
It is impossible to give a definition to a scope variable tagged as input.
Incriminated variable:
┌─⯈ tests/test_io/bad/redefining_input.catala_en:5.16-5.17:
└─┐
5 │ input output a content integer
│ ‾
└─ Test
Incriminated variable definition:
┌─⯈ tests/test_io/bad/redefining_input.catala_en:8.3-8.15:
└─┐

View File

@ -16,28 +16,25 @@ scope B:
```catala-test-inline
$ catala Typecheck
[WARNING] This variable is dead code; it does not contribute to computing any of scope "A" outputs. Did you forget something?
┌─⯈ tests/test_io/bad/using_non_output.catala_en:5.12-5.13:
└─┐
5 │ internal a content integer
│ ‾
└─ Test
[ERROR] The variable a.a cannot be used here, as it is not part of subscope a's results. Maybe you forgot to qualify it as an output?
[ERROR]
The variable a.a cannot be used here, as it is not part of subscope a's results. Maybe you forgot to qualify it as an output?
Incriminated variable usage:
┌─⯈ tests/test_io/bad/using_non_output.catala_en:14.13-14.16:
└──┐
14 │ assertion a.a = 0
│ ‾‾‾
└─ Test
Incriminated subscope variable declaration:
┌─⯈ tests/test_io/bad/using_non_output.catala_en:5.12-5.13:
└─┐
5 │ internal a content integer
│ ‾
└─ Test
Incriminated subscope declaration:
┌─⯈ tests/test_io/bad/using_non_output.catala_en:8.3-8.4:
└─┐

View File

@ -15,20 +15,17 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] I don't know how to apply operator * on types money and money
┌─⯈ tests/test_money/bad/no_mingle.catala_en:12.26-12.27:
└──┐
12 │ definition z equals (x * y)
│ ‾
└─ Article
Type money coming from expression:
┌─⯈ tests/test_money/bad/no_mingle.catala_en:5.21-5.26:
└─┐
5 │ context x content money
│ ‾‾‾‾‾
└─ Article
Type money coming from expression:
┌─⯈ tests/test_money/bad/no_mingle.catala_en:6.21-6.26:
└─┐

View File

@ -14,7 +14,6 @@ declaration glob5 content decimal
```catala-test-inline
$ catala typecheck
[ERROR] Scope calls are not allowed outside of a scope
┌─⯈ tests/test_name_resolution/bad/toplevel_defs.catala_en:11.11-11.23:
└──┐
11 │ equals (output of S1).a

View File

@ -15,15 +15,14 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[ERROR] It is impossible to give a definition to a scope variable tagged as input.
[ERROR]
It is impossible to give a definition to a scope variable tagged as input.
Incriminated variable:
┌─⯈ tests/test_proof/bad/dates_get_year-empty.catala_en:5.9-5.10:
└─┐
5 │ input x content date
│ ‾
└─ Test
Incriminated variable definition:
┌─⯈ tests/test_proof/bad/dates_get_year-empty.catala_en:9.3-9.15:
└─┐

View File

@ -24,7 +24,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/bad/enums-empty.catala_en:7.7-7.8:
└─┐
7 │ -- C content boolean

View File

@ -22,7 +22,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/bad/enums-nonbool-empty.catala_en:5.7-5.8:
└─┐
5 │ -- C content boolean

View File

@ -22,7 +22,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/bad/enums-nonbool-overlap.catala_en:5.7-5.8:
└─┐
5 │ -- C content boolean

View File

@ -24,7 +24,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/bad/enums-overlap.catala_en:7.7-7.8:
└─┐
7 │ -- C content boolean

View File

@ -17,7 +17,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C2" of enumeration "E" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/bad/enums_inj-empty.catala_en:6.6-6.8:
└─┐
6 │ -- C2

View File

@ -123,8 +123,8 @@ scope Amount:
```catala-test-inline
$ catala Proof --disable_counterexamples
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
[ERROR]
It is impossible to give a definition to a subscope variable not tagged as input or context.
Incriminated subscope:
┌─⯈ tests/test_proof/bad/prolala_motivating_example.catala_en:56.3-56.14:
└──┐
@ -132,7 +132,6 @@ Incriminated subscope:
│ ‾‾‾‾‾‾‾‾‾‾‾
└┬ ProLaLa 2022 Super Cash Bonus
└─ Amount
Incriminated variable:
┌─⯈ tests/test_proof/bad/prolala_motivating_example.catala_en:9.12-9.22:
└─┐
@ -140,7 +139,6 @@ Incriminated variable:
│ ‾‾‾‾‾‾‾‾‾‾
└┬ ProLaLa 2022 Super Cash Bonus
└─ Eligibility
Incriminated subscope variable definition:
┌─⯈ tests/test_proof/bad/prolala_motivating_example.catala_en:64.3-64.36:
└──┐

View File

@ -22,7 +22,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/good/enums-arith.catala_en:5.7-5.8:
└─┐
5 │ -- C content boolean

View File

@ -22,7 +22,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/good/enums-nonbool.catala_en:5.7-5.8:
└─┐
5 │ -- C content boolean

View File

@ -21,7 +21,6 @@ scope A:
```catala-test-inline
$ catala Proof --disable_counterexamples
[WARNING] The constructor "C" of enumeration "T" is never used; maybe it's unnecessary?
┌─⯈ tests/test_proof/good/enums.catala_en:5.7-5.8:
└─┐
5 │ -- C content boolean

View File

@ -16,23 +16,21 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] Cyclic dependency detected between the following variables of scope A:
z → x → y → z
[ERROR]
Cyclic dependency detected between the following variables of scope A:
z → x → y → z
z is used here in the definition of x:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:14.23-14.24:
└──┐
14 │ definition x equals z
│ ‾
└─ Article
x is used here in the definition of y:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:11.32-11.33:
└──┐
11 │ definition y under condition x >= 0 consequence equals x
│ ‾
└─ Article
y is used here in the definition of z:
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:13.32-13.33:
└──┐

View File

@ -28,23 +28,21 @@ scope S4:
```catala-test-inline
$ catala typecheck
[ERROR] Cyclic dependency detected between the following scopes:
S4 → S3 → S2 → S4
[ERROR]
Cyclic dependency detected between the following scopes:
S4 → S3 → S2 → S4
S4 is used here in the definition of S3:
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:21.24-21.36:
└──┐
21 │ definition o equals (output of S4).o
│ ‾‾‾‾‾‾‾‾‾‾‾‾
S3 is used here in the definition of S2:
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:18.43-18.55:
└──┐
18 │ definition o equals (output of S1).o + (output of S3).o
│ ‾‾‾‾‾‾‾‾‾‾‾‾
S2 is used here in the definition of S4:
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:24.24-24.36:
└──┐

View File

@ -18,16 +18,14 @@ scope B:
```catala-test-inline
$ catala Interpret -s A
[ERROR] Cyclic dependency detected between the following scopes:
B → A → B
[ERROR]
Cyclic dependency detected between the following scopes: B → A → B
B is used here in the definition of A:
┌─⯈ tests/test_scope/bad/cyclic_scopes.catala_en:5.3-5.4:
└─┐
5 │ b scope B
│ ‾
└─ Article
A is used here in the definition of B:
┌─⯈ tests/test_scope/bad/cyclic_scopes.catala_en:9.3-9.4:
└─┐

View File

@ -16,15 +16,14 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
[ERROR]
There is a conflict between multiple valid consequences for assigning the same variable.
This consequence has a valid justification:
┌─⯈ tests/test_scope/bad/scope.catala_en:13.57-13.61:
└──┐
13 │ definition b under condition not c consequence equals 1337
│ ‾‾‾‾
└─ Article
This consequence has a valid justification:
┌─⯈ tests/test_scope/bad/scope.catala_en:14.57-14.58:
└──┐

View File

@ -17,7 +17,6 @@ scope Titi:
```catala-test-inline
$ catala dcalc -s Titi
[ERROR] Duplicate definition of scope input variable 'bar'
┌─⯈ tests/test_scope/bad/scope_call_duplicate.catala_en:14.70-14.73:
└──┐
14 │ definition fizz equals output of Toto with {--bar: 1 --baz: 2.1 -- bar: 3}

View File

@ -17,13 +17,11 @@ scope Titi:
```catala-test-inline
$ catala dcalc -s Titi
[ERROR] Scope Toto has no input variable biz
┌─⯈ tests/test_scope/bad/scope_call_extra.catala_en:14.49-14.52:
└──┐
14 │ definition fizz equals output of Toto with {--biz: 1}
│ ‾‾‾
Scope Toto declared here
┌─⯈ tests/test_scope/bad/scope_call_extra.catala_en:2.19-2.23:
└─┐

View File

@ -17,13 +17,11 @@ scope Titi:
```catala-test-inline
$ catala dcalc -s Titi
[ERROR] Definition of input variable 'baz' missing in this scope call
┌─⯈ tests/test_scope/bad/scope_call_missing.catala_en:14.26-14.56:
└──┐
14 │ definition fizz equals output of Toto with {--bar: 1}
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
Declaration of the missing input variable
┌─⯈ tests/test_scope/bad/scope_call_missing.catala_en:4.16-4.19:
└─┐

View File

@ -15,8 +15,8 @@ scope B:
```catala-test-inline
$ catala Interpret -s A
[ERROR] The subscope a is used when defining one of its inputs, but recursion is forbidden in Catala
[ERROR]
The subscope a is used when defining one of its inputs, but recursion is forbidden in Catala
┌─⯈ tests/test_scope/bad/sub_vars_in_sub_var.catala_en:13.28-13.31:
└──┐
13 │ definition a.y equals if a.x then 0 else 1

View File

@ -8,7 +8,6 @@ declaration scope Foo2:
```catala-test-inline
$ catala Scalc -s Foo2 -O -t
[WARNING] In scope "Foo2", the variable "bar" is declared but never defined; did you forget something?
┌─⯈ tests/test_scope/good/nothing.catala_en:5.10-5.13:
└─┐
5 │ output bar content integer

View File

@ -19,14 +19,12 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] struct name "S" already defined
First definition:
┌─⯈ tests/test_struct/bad/bug_107.catala_en:4.23-4.24:
└─┐
4 │ declaration structure S:
│ ‾
└─ https://github.com/CatalaLang/catala/issues/107
Second definition:
┌─⯈ tests/test_struct/bad/bug_107.catala_en:8.23-8.24:
└─┐

View File

@ -9,8 +9,8 @@ declaration scope Bar:
```catala-test-inline
$ catala Typecheck
[ERROR] The struct Foo does not have any fields; give it some for Catala to be able to accept it.
[ERROR]
The struct Foo does not have any fields; give it some for Catala to be able to accept it.
┌─⯈ tests/test_struct/bad/empty_struct.catala_en:4.23-4.26:
└─┐
4 │ declaration structure Foo:

View File

@ -15,14 +15,13 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[WARNING] The constructor "Rec" of enumeration "E" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/bad/nested.catala_en:6.6-6.9:
└─┐
6 │ -- Rec content E
│ ‾‾‾
└─ Article
[ERROR] The type E is defined using itself, which is forbidden since Catala does not provide recursive types
[ERROR]
The type E is defined using itself, which is forbidden since Catala does not provide recursive types
┌─⯈ tests/test_struct/bad/nested.catala_en:6.18-6.19:
└─┐
6 │ -- Rec content E

View File

@ -16,49 +16,42 @@ declaration scope A:
```catala-test-inline
$ catala Interpret -s A
[WARNING] In scope "A", the variable "x" is declared but never defined; did you forget something?
┌─⯈ tests/test_struct/bad/nested2.catala_en:13.10-13.11:
└──┐
13 │ output x content E
│ ‾
└─ Article
[WARNING] The structure "S" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/bad/nested2.catala_en:4.23-4.24:
└─┐
4 │ declaration structure S:
│ ‾
└─ Article
[WARNING] The enumeration "E" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/bad/nested2.catala_en:8.25-8.26:
└─┐
8 │ declaration enumeration E:
│ ‾
└─ Article
[ERROR] Cyclic dependency detected between types!
Cycle type S, declared:
┌─⯈ tests/test_struct/bad/nested2.catala_en:4.23-4.24:
└─┐
4 │ declaration structure S:
│ ‾
└─ Article
Used here in the definition of another cycle type E:
┌─⯈ tests/test_struct/bad/nested2.catala_en:10.20-10.21:
└──┐
10 │ -- Case2 content S
│ ‾
└─ Article
Cycle type E, declared:
┌─⯈ tests/test_struct/bad/nested2.catala_en:8.25-8.26:
└─┐
8 │ declaration enumeration E:
│ ‾
└─ Article
Used here in the definition of another cycle type S:
┌─⯈ tests/test_struct/bad/nested2.catala_en:5.18-5.19:
└─┐

View File

@ -16,7 +16,6 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] No struct named Fo found
┌─⯈ tests/test_struct/bad/nonexisting_struct.catala_en:13.25-13.27:
└──┐
13 │ definition y equals x.Fo.f

View File

@ -20,7 +20,6 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[ERROR] Field "g" does not belong to structure "Foo", but to "Bar"
┌─⯈ tests/test_struct/bad/wrong_qualified_field.catala_en:17.23-17.30:
└──┐
17 │ definition y equals x.Foo.g

View File

@ -19,7 +19,6 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/good/ambiguous_fields.catala_en:7.23-7.26:
└─┐
7 │ declaration structure Bar:
@ -31,7 +30,6 @@ $ catala Interpret -s A
```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/good/ambiguous_fields.catala_en:7.23-7.26:
└─┐
7 │ declaration structure Bar:

View File

@ -19,7 +19,6 @@ scope A:
```catala-test-inline
$ catala Interpret -s A
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/good/same_name_fields.catala_en:7.23-7.26:
└─┐
7 │ declaration structure Bar:
@ -32,7 +31,6 @@ $ catala Interpret -s A
```catala-test-inline
$ catala Interpret_Lcalc -s A --avoid_exceptions --optimize
[WARNING] The structure "Bar" is never used; maybe it's unnecessary?
┌─⯈ tests/test_struct/good/same_name_fields.catala_en:7.23-7.26:
└─┐
7 │ declaration structure Bar:

View File

@ -15,21 +15,18 @@ $ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
┌─⯈ decimal
└─⯈ integer
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err1.catala_en:7.23-7.26:
└─┐
7 │ Structure { -- i: 4.1 -- e: y };
│ ‾‾‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/err1.catala_en:7.23-7.26:
└─┐
7 │ Structure { -- i: 4.1 -- e: y };
│ ‾‾‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:8.18-8.25:
└─┐

View File

@ -12,24 +12,22 @@ scope S:
```catala-test-inline
$ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
┌─⯈ decimal
└─⯈ collection
[ERROR]
Error during typechecking, incompatible types:
┌─⯈ decimal
└─⯈ collection
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err2.catala_en:10.39-10.42:
└──┐
10 │ definition a equals number of (z ++ 1.1) / 2
│ ‾‾‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/err2.catala_en:10.39-10.42:
└──┐
10 │ definition a equals number of (z ++ 1.1) / 2
│ ‾‾‾
Type collection coming from expression:
┌─⯈ tests/test_typing/bad/err2.catala_en:10.36-10.38:
└──┐

View File

@ -13,7 +13,6 @@ scope S:
```catala-test-inline
$ catala Typecheck
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
└─┐
4 │ -- Dec content decimal
@ -22,21 +21,18 @@ $ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
┌─⯈ integer
└─⯈ decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
└──┐
@ -51,7 +47,6 @@ Re-putting the same check again, to ensure that the `Typecheck` and `ocaml` subc
```catala-test-inline
$ catala ocaml
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
└─┐
4 │ -- Dec content decimal
@ -60,21 +55,18 @@ $ catala ocaml
[ERROR] Error during typechecking, incompatible types:
┌─⯈ integer
└─⯈ decimal
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
└──┐
10 │ definition a equals number of (z ++ z) * 2
│ ‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
└──┐

View File

@ -11,21 +11,18 @@ Should be "catala Typecheck", see test err3
```catala-test-inline
$ catala ocaml
[WARNING] The structure "Structure" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:7.23-7.32:
└─┐
7 │ declaration structure Structure:
│ ‾‾‾‾‾‾‾‾‾
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
└─┐
4 │ -- Dec content decimal
│ ‾‾‾
[WARNING] The constructor "Dat" of enumeration "Enum" is never used; maybe it's unnecessary?
┌─⯈ tests/test_typing/bad/common.catala_en:5.6-5.9:
└─┐
5 │ -- Dat content date
@ -34,21 +31,18 @@ $ catala ocaml
[ERROR] Error during typechecking, incompatible types:
┌─⯈ Enum
└─⯈ Structure
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err4.catala_en:5.25-5.38:
└─┐
5 │ definition z equals [ Int content x ]
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
Type Enum coming from expression:
┌─⯈ tests/test_typing/bad/err4.catala_en:5.25-5.38:
└─┐
5 │ definition z equals [ Int content x ]
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
Type Structure coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:14.31-14.40:
└──┐

View File

@ -12,24 +12,22 @@ scope S:
```catala-test-inline
$ catala Typecheck
[ERROR] Error during typechecking, incompatible types:
┌─⯈ integer
└─⯈ Structure
[ERROR]
Error during typechecking, incompatible types:
┌─⯈ integer
└─⯈ Structure
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err5.catala_en:8.5-8.9:
└─┐
8 │ 1040
│ ‾‾‾‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/err5.catala_en:8.5-8.9:
└─┐
8 │ 1040
│ ‾‾‾‾
Type Structure coming from expression:
┌─⯈ tests/test_typing/bad/err5.catala_en:6.5-6.46:
└─┐

View File

@ -31,21 +31,18 @@ $ catala ocaml
[ERROR] Error during typechecking, incompatible types:
┌─⯈ decimal
└─⯈ integer
Error coming from typechecking the following expression:
┌─⯈ tests/test_typing/bad/err6.catala_en:20.27-20.30:
└──┐
20 │ definition sub.x equals 44.
│ ‾‾‾
Type decimal coming from expression:
┌─⯈ tests/test_typing/bad/err6.catala_en:20.27-20.30:
└──┐
20 │ definition sub.x equals 44.
│ ‾‾‾
Type integer coming from expression:
┌─⯈ tests/test_typing/bad/common.catala_en:12.19-12.26:
└──┐

View File

@ -12,14 +12,13 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] This definition does not indicate which state has to be considered for variable foo.
[ERROR]
This definition does not indicate which state has to be considered for variable foo.
┌─⯈ tests/test_variable_state/bad/def_no_state.catala_en:10.14-10.17:
└──┐
10 │ definition foo equals 2
│ ‾‾‾
└─ Test
Variable declaration:
┌─⯈ tests/test_variable_state/bad/def_no_state.catala_en:5.10-5.13:
└─┐

View File

@ -12,15 +12,14 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] There are two states with the same name for the same variable: this is ambiguous. Please change the name of either states.
[ERROR]
There are two states with the same name for the same variable: this is ambiguous. Please change the name of either states.
First instance of state "bar":
┌─⯈ tests/test_variable_state/bad/double_same_state.catala_en:6.11-6.14:
└─┐
6 │ state bar
│ ‾‾‾
└─ Test
Second instance of state "bar":
┌─⯈ tests/test_variable_state/bad/double_same_state.catala_en:7.11-7.14:
└─┐

View File

@ -17,7 +17,6 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] Unknown label for the scope variable foo.baz: "thing"
┌─⯈ tests/test_variable_state/bad/no_cross_exceptions.catala_en:14.13-14.18:
└──┐
14 │ exception thing definition foo state baz under condition true consequence equals 3

View File

@ -14,8 +14,8 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] It is impossible to refer to the variable you are defining when defining its first state.
[ERROR]
It is impossible to refer to the variable you are defining when defining its first state.
┌─⯈ tests/test_variable_state/bad/self_reference_first_state.catala_en:10.35-10.38:
└──┐
10 │ definition foo state bar equals foo + 1

View File

@ -21,30 +21,27 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] Cyclic dependency detected between the following variables of scope A:
foofoo@bar → foofoo@baz → foo@bar → foo@baz → foofoo@bar
[ERROR]
Cyclic dependency detected between the following variables of scope A:
foofoo@bar → foofoo@baz → foo@bar → foo@baz → foofoo@bar
foofoo@bar is used here in the definition of foofoo@baz:
┌─⯈ tests/test_variable_state/bad/state_cycle.catala_en:19.38-19.44:
└──┐
19 │ definition foofoo state baz equals foofoo + 1
│ ‾‾‾‾‾‾
└─ Test
foofoo@baz is used here in the definition of foo@bar:
┌─⯈ tests/test_variable_state/bad/state_cycle.catala_en:13.35-13.41:
└──┐
13 │ definition foo state bar equals foofoo
│ ‾‾‾‾‾‾
└─ Test
foo@bar is used here in the definition of foo@baz:
┌─⯈ tests/test_variable_state/bad/state_cycle.catala_en:15.35-15.38:
└──┐
15 │ definition foo state baz equals foo + 1
│ ‾‾‾
└─ Test
foo@baz is used here in the definition of foofoo@bar:
┌─⯈ tests/test_variable_state/bad/state_cycle.catala_en:17.38-17.41:
└──┐

View File

@ -15,13 +15,11 @@ scope A:
```catala-test-inline
$ catala Typecheck
[ERROR] This identifier is not a state declared for variable foo.
┌─⯈ tests/test_variable_state/bad/unknown_state.catala_en:12.24-12.28:
└──┐
12 │ definition foo state basz equals foo + 1
│ ‾‾‾‾
└─ Test
Variable declaration:
┌─⯈ tests/test_variable_state/bad/unknown_state.catala_en:5.10-5.13:
└─┐