mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Cleaner message printing (#614)
This commit is contained in:
commit
8d659d0557
@ -115,11 +115,11 @@ let pp_marker target ppf =
|
||||
let open Ocolor_types in
|
||||
let tags, str =
|
||||
match target with
|
||||
| Debug -> [Bold; Fg (C4 magenta)], "[DEBUG]"
|
||||
| Error -> [Bold; Fg (C4 red)], "[ERROR]"
|
||||
| Warning -> [Bold; Fg (C4 yellow)], "[WARNING]"
|
||||
| Result -> [Bold; Fg (C4 green)], "[RESULT]"
|
||||
| Log -> [Bold; Fg (C4 black)], "[LOG]"
|
||||
| Debug -> [Bold; Fg (C4 magenta)], "DEBUG"
|
||||
| Error -> [Bold; Fg (C4 red)], "ERROR"
|
||||
| Warning -> [Bold; Fg (C4 yellow)], "WARNING"
|
||||
| Result -> [Bold; Fg (C4 green)], "RESULT"
|
||||
| Log -> [Bold; Fg (C4 black)], "LOG"
|
||||
in
|
||||
if target = Debug then print_time_marker ppf ();
|
||||
Format.pp_open_stag ppf (Ocolor_format.Ocolor_styles_tag tags);
|
||||
@ -164,28 +164,117 @@ module Content = struct
|
||||
let of_string (s : string) : t =
|
||||
[MainMessage (fun ppf -> Format.pp_print_text ppf s)]
|
||||
|
||||
let basic_msg ppf target content =
|
||||
Format.pp_open_vbox ppf 0;
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf "@,@,")
|
||||
(fun ppf -> function
|
||||
| Position pos ->
|
||||
Option.iter
|
||||
(fun msg -> Format.fprintf ppf "@[<hov>%t@]@," msg)
|
||||
pos.pos_message;
|
||||
Pos.format_loc_text ppf pos.pos
|
||||
| MainMessage msg ->
|
||||
Format.fprintf ppf "@[<hov 2>[%t] %t@]" (pp_marker target) msg
|
||||
| Outcome msg ->
|
||||
Format.fprintf ppf "@[<hov>[%t]@ %t@]" (pp_marker target) msg
|
||||
| Suggestion suggestions_list -> Suggestions.format ppf suggestions_list)
|
||||
ppf content;
|
||||
Format.pp_close_box ppf ();
|
||||
Format.pp_print_newline ppf ()
|
||||
|
||||
let fancy_msg ppf target content =
|
||||
let ppf_out_fcts = Format.pp_get_formatter_out_functions ppf () in
|
||||
let restore_ppf () =
|
||||
Format.pp_print_flush ppf ();
|
||||
Format.pp_set_formatter_out_functions ppf ppf_out_fcts
|
||||
in
|
||||
let getcolorstr pp =
|
||||
let buf = Buffer.create 17 in
|
||||
let ppfb = Format.formatter_of_buffer buf in
|
||||
Format.pp_set_formatter_stag_functions ppfb
|
||||
(Format.pp_get_formatter_stag_functions ppf ());
|
||||
Format.pp_set_mark_tags ppfb (Format.pp_get_mark_tags ppf ());
|
||||
pp ppfb;
|
||||
Format.pp_print_flush ppfb ();
|
||||
Buffer.contents buf
|
||||
in
|
||||
(* The following adds a blue line on the left *)
|
||||
Format.pp_set_formatter_out_functions ppf
|
||||
{
|
||||
ppf_out_fcts with
|
||||
out_indent =
|
||||
(fun n ->
|
||||
let lead =
|
||||
getcolorstr (fun ppf -> Format.fprintf ppf "@{<blue>@<1>%s@}" "│")
|
||||
in
|
||||
if n >= 1 then ppf_out_fcts.out_string lead 0 (String.length lead);
|
||||
if n >= 2 then ppf_out_fcts.out_indent (n - 1));
|
||||
};
|
||||
Format.pp_open_vbox ppf 1;
|
||||
Format.fprintf ppf "@{<blue>@<2>%s[%t]@<2>%s@}" "┌─" (pp_marker target) "─";
|
||||
(* Returns true when a finaliser is needed *)
|
||||
let print_elt ppf ?(islast = false) = function
|
||||
| MainMessage msg ->
|
||||
Format.fprintf ppf "@,@[<v 2>@,@[<hov>%t@]@]" msg;
|
||||
if islast then Format.pp_print_cut ppf ();
|
||||
true
|
||||
| Position pos -> (
|
||||
Format.pp_print_cut ppf ();
|
||||
Option.iter
|
||||
(fun msg -> Format.fprintf ppf "@[<v 1>@,@[<hov 2>%t@]@]" msg)
|
||||
pos.pos_message;
|
||||
Format.pp_print_break ppf 0 (-1);
|
||||
let pr_head, pr_context, pr_legal = Pos.format_loc_text_parts pos.pos in
|
||||
Format.pp_open_vbox ppf 2;
|
||||
Format.fprintf ppf "@{<blue>@<1>%s@}%t" "├" pr_head;
|
||||
pr_context ppf;
|
||||
Format.pp_close_box ppf ();
|
||||
match pr_legal with
|
||||
| None -> true
|
||||
| Some pr_legal ->
|
||||
Format.pp_print_break ppf 0 (-1);
|
||||
if islast then (
|
||||
restore_ppf ();
|
||||
Format.pp_open_vbox ppf 3;
|
||||
Format.fprintf ppf "@{<blue>@<3>%s@}%t" "└─ " pr_legal)
|
||||
else (
|
||||
Format.pp_open_vbox ppf 3;
|
||||
Format.fprintf ppf "@{<blue>@<3>%s@}%t" "├─ " pr_legal);
|
||||
Format.pp_close_box ppf ();
|
||||
not islast)
|
||||
| Outcome msg ->
|
||||
Format.fprintf ppf "@;<0 1>@[<v 1>@[<hov 2>%t@]@]" msg;
|
||||
true
|
||||
| Suggestion suggestions_list ->
|
||||
Format.fprintf ppf "@,@[<v 1>@,@[<hov 2>%a@]@]" Suggestions.format
|
||||
suggestions_list;
|
||||
true
|
||||
in
|
||||
let rec print_lines ppf = function
|
||||
| [elt] ->
|
||||
let finalise = print_elt ppf ~islast:true elt in
|
||||
Format.pp_close_box ppf ();
|
||||
if finalise then Format.fprintf ppf "@,@{<blue>@<2>%s@}" "└─"
|
||||
| elt :: r ->
|
||||
let _ = print_elt ppf elt in
|
||||
print_lines ppf r
|
||||
| [] ->
|
||||
Format.pp_close_box ppf ();
|
||||
Format.pp_print_cut ppf ()
|
||||
in
|
||||
print_lines ppf content;
|
||||
Format.pp_close_box ppf ();
|
||||
restore_ppf ();
|
||||
Format.pp_print_newline ppf ()
|
||||
|
||||
let emit (content : t) (target : level) : unit =
|
||||
match Global.options.message_format with
|
||||
| Global.Human ->
|
||||
| Global.Human -> (
|
||||
let ppf = get_ppf target in
|
||||
Format.pp_open_vbox ppf 0;
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf "@,@,")
|
||||
(fun ppf -> function
|
||||
| Position pos ->
|
||||
Option.iter
|
||||
(fun msg -> Format.fprintf ppf "@[<hov>%t@]@," msg)
|
||||
pos.pos_message;
|
||||
Pos.format_loc_text ppf pos.pos
|
||||
| MainMessage msg ->
|
||||
Format.fprintf ppf "@[<hov 2>%t %t@]" (pp_marker target) msg
|
||||
| Outcome msg ->
|
||||
Format.fprintf ppf "@[<hov>%t@ %t@]" (pp_marker target) msg
|
||||
| Suggestion suggestions_list ->
|
||||
Suggestions.format ppf suggestions_list)
|
||||
ppf content;
|
||||
Format.pp_close_box ppf ();
|
||||
Format.pp_print_newline ppf ()
|
||||
match target with
|
||||
| Debug | Log -> basic_msg ppf target content
|
||||
| Result | Warning | Error -> fancy_msg ppf target content)
|
||||
| Global.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
|
||||
@ -222,7 +311,7 @@ module Content = struct
|
||||
(fun pos ->
|
||||
Format.fprintf ppf "@{<blue>%s@}: " (Pos.to_string_short pos))
|
||||
pos;
|
||||
pp_marker target ppf;
|
||||
Format.fprintf ppf "[%t]" (pp_marker target);
|
||||
match message with
|
||||
| Some message ->
|
||||
Format.pp_print_char ppf ' ';
|
||||
@ -247,6 +336,7 @@ type ('a, 'b) emitter =
|
||||
?pos_msg:Content.message ->
|
||||
?extra_pos:(string * Pos.t) list ->
|
||||
?fmt_pos:(Content.message * Pos.t) list ->
|
||||
?outcome:Content.message list ->
|
||||
?suggestion:string list ->
|
||||
('a, Format.formatter, unit, 'b) format4 ->
|
||||
'a
|
||||
@ -258,47 +348,58 @@ let make
|
||||
?pos_msg
|
||||
?extra_pos
|
||||
?fmt_pos
|
||||
?(outcome = [])
|
||||
?(suggestion = [])
|
||||
~cont
|
||||
~level =
|
||||
Format.kdprintf
|
||||
@@ fun message ->
|
||||
let t =
|
||||
match level with Result -> of_result message | _ -> of_message message
|
||||
in
|
||||
let t = match header with Some h -> prepend_message t h | None -> t in
|
||||
let t = if internal then to_internal_error t else t in
|
||||
let t =
|
||||
match pos with Some p -> add_position t ?message:pos_msg p | None -> t
|
||||
in
|
||||
let t =
|
||||
match extra_pos with
|
||||
| Some pl ->
|
||||
List.fold_left
|
||||
(fun t (message, p) ->
|
||||
let message =
|
||||
if message = "" then None
|
||||
else Some (fun ppf -> Format.pp_print_text ppf message)
|
||||
in
|
||||
add_position t ?message p)
|
||||
t pl
|
||||
| None -> t
|
||||
in
|
||||
let t =
|
||||
match fmt_pos with
|
||||
| Some pl ->
|
||||
List.fold_left
|
||||
(fun t (message, p) ->
|
||||
let message = if message == ignore then None else Some message in
|
||||
add_position t ?message p)
|
||||
t pl
|
||||
| None -> t
|
||||
in
|
||||
let t = match suggestion with [] -> t | s -> add_suggestion t s in
|
||||
cont t level
|
||||
match level with
|
||||
| Debug when not Global.options.debug ->
|
||||
Format.ikfprintf (fun _ -> cont [] level) (Lazy.force ignore_ppf)
|
||||
| Warning when Global.options.disable_warnings ->
|
||||
Format.ikfprintf (fun _ -> cont [] level) (Lazy.force ignore_ppf)
|
||||
| _ ->
|
||||
Format.kdprintf
|
||||
@@ fun message ->
|
||||
let t =
|
||||
match level with Result -> of_result message | _ -> of_message message
|
||||
in
|
||||
let t = match header with Some h -> prepend_message t h | None -> t in
|
||||
let t = if internal then to_internal_error t else t in
|
||||
let t =
|
||||
match outcome with [] -> t | o -> t @ List.map (fun o -> Outcome o) o
|
||||
in
|
||||
let t =
|
||||
match pos with Some p -> add_position t ?message:pos_msg p | None -> t
|
||||
in
|
||||
let t =
|
||||
match extra_pos with
|
||||
| Some pl ->
|
||||
List.fold_left
|
||||
(fun t (message, p) ->
|
||||
let message =
|
||||
if message = "" then None
|
||||
else Some (fun ppf -> Format.pp_print_text ppf message)
|
||||
in
|
||||
add_position t ?message p)
|
||||
t pl
|
||||
| None -> t
|
||||
in
|
||||
let t =
|
||||
match fmt_pos with
|
||||
| Some pl ->
|
||||
List.fold_left
|
||||
(fun t (message, p) ->
|
||||
let message = if message == ignore then None else Some message in
|
||||
add_position t ?message p)
|
||||
t pl
|
||||
| None -> t
|
||||
in
|
||||
let t = match suggestion with [] -> t | s -> add_suggestion t s in
|
||||
cont t level
|
||||
|
||||
let debug = make ~level:Debug ~cont:emit
|
||||
let log = make ~level:Log ~cont:emit
|
||||
let result = make ~level:Result ~cont:emit
|
||||
let results r = emit (List.flatten (List.map of_result r)) Result
|
||||
let warning = make ~level:Warning ~cont:emit
|
||||
let error = make ~level:Error ~cont:(fun m _ -> raise (CompilerError m))
|
||||
|
@ -89,6 +89,7 @@ type ('a, 'b) emitter =
|
||||
?pos_msg:Content.message ->
|
||||
?extra_pos:(string * Pos.t) list ->
|
||||
?fmt_pos:(Content.message * Pos.t) list ->
|
||||
?outcome:Content.message list ->
|
||||
?suggestion:string list ->
|
||||
('a, Format.formatter, unit, 'b) format4 ->
|
||||
'a
|
||||
@ -98,3 +99,4 @@ val debug : ('a, unit) emitter
|
||||
val result : ('a, unit) emitter
|
||||
val warning : ('a, unit) emitter
|
||||
val error : ('a, 'b) emitter
|
||||
val results : Content.message list -> unit
|
||||
|
@ -121,102 +121,136 @@ let utf8_byte_index s ui0 =
|
||||
in
|
||||
aux 0 0
|
||||
|
||||
let format_loc_text ppf (pos : t) =
|
||||
try
|
||||
let filename = get_file pos in
|
||||
if filename = "" then Format.pp_print_string ppf "No position information"
|
||||
else
|
||||
let sline = get_start_line pos in
|
||||
let eline = get_end_line pos in
|
||||
let ic, input_line_opt =
|
||||
let from_contents =
|
||||
match Global.options.input_src with
|
||||
| Contents (str, _) when str = filename -> Some str
|
||||
| _ -> None
|
||||
in
|
||||
match from_contents with
|
||||
| Some str ->
|
||||
let line_index = ref 0 in
|
||||
let lines = String.split_on_char '\n' str in
|
||||
let input_line_opt () : string option =
|
||||
match List.nth_opt lines !line_index with
|
||||
| Some l ->
|
||||
line_index := !line_index + 1;
|
||||
Some l
|
||||
| None -> None
|
||||
let format_loc_text_parts (pos : t) =
|
||||
let filename = get_file pos in
|
||||
if filename = "" then
|
||||
( (fun ppf -> Format.pp_print_string ppf "No position information"),
|
||||
ignore,
|
||||
None )
|
||||
else
|
||||
let pr_head ppf =
|
||||
Format.fprintf ppf "@{<blue>─➤ @{<bold>%s:@}@}@," (to_string_short pos)
|
||||
in
|
||||
let pr_context, pr_legal =
|
||||
try
|
||||
let sline = get_start_line pos in
|
||||
let eline = get_end_line pos in
|
||||
let ic, input_line_opt =
|
||||
let from_contents =
|
||||
match Global.options.input_src with
|
||||
| Contents (str, _) when str = filename -> Some str
|
||||
| _ -> None
|
||||
in
|
||||
None, input_line_opt
|
||||
| None -> (
|
||||
try
|
||||
let ic = open_in filename in
|
||||
match from_contents with
|
||||
| Some str ->
|
||||
let line_index = ref 0 in
|
||||
let lines = String.split_on_char '\n' str in
|
||||
let input_line_opt () : string option =
|
||||
try Some (input_line ic) with End_of_file -> None
|
||||
match List.nth_opt lines !line_index with
|
||||
| Some l ->
|
||||
line_index := !line_index + 1;
|
||||
Some l
|
||||
| None -> None
|
||||
in
|
||||
Some ic, input_line_opt
|
||||
with Sys_error _ -> None, fun () -> None)
|
||||
in
|
||||
let include_extra_count = 0 in
|
||||
let rec get_lines (n : int) : (int * string) list =
|
||||
match input_line_opt () with
|
||||
| Some line ->
|
||||
if n < sline - include_extra_count then get_lines (n + 1)
|
||||
else if
|
||||
n >= sline - include_extra_count && n <= eline + include_extra_count
|
||||
then (n, line) :: get_lines (n + 1)
|
||||
else []
|
||||
| None -> []
|
||||
in
|
||||
let pos_lines = get_lines 1 in
|
||||
let nspaces = int_of_float (log10 (float_of_int eline)) + 1 in
|
||||
let legal_pos_lines =
|
||||
List.rev_map
|
||||
(fun s ->
|
||||
Re.Pcre.substitute ~rex:(Re.Pcre.regexp "\n\\s*")
|
||||
~subst:(fun _ -> " ")
|
||||
s)
|
||||
pos.law_pos
|
||||
in
|
||||
(match ic with None -> () | Some ic -> close_in ic);
|
||||
let print_matched_line ppf ((line_no, line) : int * string) =
|
||||
let line_indent = indent_number line in
|
||||
let match_start_index =
|
||||
utf8_byte_index line
|
||||
(if line_no = sline then get_start_column pos - 1 else line_indent)
|
||||
None, input_line_opt
|
||||
| None -> (
|
||||
try
|
||||
let ic = open_in filename in
|
||||
let input_line_opt () : string option =
|
||||
try Some (input_line ic) with End_of_file -> None
|
||||
in
|
||||
Some ic, input_line_opt
|
||||
with Sys_error _ -> None, fun () -> None)
|
||||
in
|
||||
let match_end_index =
|
||||
if line_no = eline then utf8_byte_index line (get_end_column pos - 1)
|
||||
else String.length line
|
||||
let include_extra_count = 0 in
|
||||
let rec get_lines (n : int) : (int * string) list =
|
||||
match input_line_opt () with
|
||||
| Some line ->
|
||||
if n < sline - include_extra_count then get_lines (n + 1)
|
||||
else if
|
||||
n >= sline - include_extra_count
|
||||
&& n <= eline + include_extra_count
|
||||
then (n, line) :: get_lines (n + 1)
|
||||
else []
|
||||
| None -> []
|
||||
in
|
||||
let unmatched_prefix = String.sub line 0 match_start_index in
|
||||
let matched_substring =
|
||||
String.sub line match_start_index
|
||||
(max 0 (match_end_index - match_start_index))
|
||||
let pos_lines = get_lines 1 in
|
||||
let nspaces = int_of_float (log10 (float_of_int eline)) + 1 in
|
||||
(match ic with None -> () | Some ic -> close_in ic);
|
||||
let print_matched_line ppf ((line_no, line) : int * string) =
|
||||
let line_indent = indent_number line in
|
||||
let match_start_index =
|
||||
utf8_byte_index line
|
||||
(if line_no = sline then get_start_column pos - 1 else line_indent)
|
||||
in
|
||||
let match_end_index =
|
||||
if line_no = eline then utf8_byte_index line (get_end_column pos - 1)
|
||||
else String.length line
|
||||
in
|
||||
let unmatched_prefix = String.sub line 0 match_start_index in
|
||||
let matched_substring =
|
||||
String.sub line match_start_index
|
||||
(max 0 (match_end_index - match_start_index))
|
||||
in
|
||||
let match_start_col = String.width unmatched_prefix in
|
||||
let match_num_cols = String.width matched_substring in
|
||||
Format.fprintf ppf "@{<blue>%*d │@} %a" nspaces line_no
|
||||
(fun ppf -> Format.pp_print_as ppf (String.width line))
|
||||
line;
|
||||
Format.pp_print_cut ppf ();
|
||||
if line_no >= sline && line_no <= eline then
|
||||
Format.fprintf ppf "@{<blue>%s │@} %s@{<bold;red>%a@}"
|
||||
(string_repeat nspaces " ")
|
||||
(string_repeat match_start_col " ")
|
||||
(fun ppf -> Format.pp_print_as ppf match_num_cols)
|
||||
(string_repeat match_num_cols "‾")
|
||||
in
|
||||
let match_start_col = String.width unmatched_prefix in
|
||||
let match_num_cols = String.width matched_substring in
|
||||
Format.fprintf ppf "@{<bold;blue>%*d │@} %s@," nspaces line_no line;
|
||||
if line_no >= sline && line_no <= eline then
|
||||
Format.fprintf ppf "@{<bold;blue>%s │@} %s@{<bold;red>%s@}"
|
||||
(string_repeat nspaces " ")
|
||||
(string_repeat match_start_col " ")
|
||||
(string_repeat match_num_cols "‾")
|
||||
in
|
||||
Format.pp_open_vbox ppf 0;
|
||||
Format.fprintf ppf "@{<bold;blue>┌─⯈ %s:@}@," (to_string_short pos);
|
||||
Format.fprintf ppf "@{<bold;blue>└%s┐@}@," (string_repeat nspaces "─");
|
||||
Format.pp_print_list print_matched_line ppf pos_lines;
|
||||
(* Format.pp_print_cut ppf (); *)
|
||||
let rec pp_legal nspaces = function
|
||||
| [last] ->
|
||||
Format.fprintf ppf "@,@{<bold;blue>%*s└─ %s@}" nspaces "" last
|
||||
| l :: lines ->
|
||||
Format.fprintf ppf "@,@{<bold;blue>%*s└┬ %s@}" nspaces "" l;
|
||||
pp_legal (nspaces + 1) lines
|
||||
| [] -> ()
|
||||
in
|
||||
pp_legal (nspaces + 1) legal_pos_lines;
|
||||
Format.pp_close_box ppf ()
|
||||
with Sys_error _ -> Format.fprintf ppf "Location: %s" (to_string pos)
|
||||
let pr_context ppf =
|
||||
Format.fprintf ppf "@{<blue> %s│@}@," (string_repeat nspaces " ");
|
||||
Format.pp_print_list print_matched_line ppf pos_lines
|
||||
in
|
||||
let legal_pos_lines =
|
||||
List.rev_map
|
||||
(fun s ->
|
||||
Re.Pcre.substitute ~rex:(Re.Pcre.regexp "\n\\s*")
|
||||
~subst:(fun _ -> " ")
|
||||
s)
|
||||
pos.law_pos
|
||||
in
|
||||
let rec pp_legal nspaces leg ppf =
|
||||
match leg with
|
||||
| [last] ->
|
||||
Format.fprintf ppf "@,@{<blue>%*s@<2>%s %s@}" nspaces "" "└─" last
|
||||
| l :: lines ->
|
||||
Format.fprintf ppf "@,@{<blue>%*s@<2>%s %s@}" nspaces "" "└┬" l;
|
||||
pp_legal (nspaces + 1) lines ppf
|
||||
| [] -> ()
|
||||
in
|
||||
let pr_law =
|
||||
match legal_pos_lines with
|
||||
| [] -> None
|
||||
| fst :: rest ->
|
||||
Some
|
||||
(fun ppf ->
|
||||
Format.fprintf ppf "@{<blue>%s@}" fst;
|
||||
pp_legal 0 rest ppf)
|
||||
in
|
||||
pr_context, pr_law
|
||||
with Sys_error _ -> ignore, None
|
||||
in
|
||||
pr_head, pr_context, pr_legal
|
||||
|
||||
let format_loc_text ppf t =
|
||||
let pr_head, pr_context, pr_legal = format_loc_text_parts t in
|
||||
Format.pp_open_vbox ppf 0;
|
||||
pr_head ppf;
|
||||
pr_context ppf;
|
||||
Option.iter
|
||||
(fun f ->
|
||||
Format.pp_print_cut ppf ();
|
||||
f ppf)
|
||||
pr_legal;
|
||||
Format.pp_close_box ppf ()
|
||||
|
||||
let no_pos : t =
|
||||
let zero_pos =
|
||||
|
@ -59,5 +59,13 @@ val format_loc_text : Format.formatter -> t -> unit
|
||||
(** Open the file corresponding to the position and retrieves the text concerned
|
||||
by the position *)
|
||||
|
||||
val format_loc_text_parts :
|
||||
t ->
|
||||
(Format.formatter -> unit)
|
||||
* (Format.formatter -> unit)
|
||||
* (Format.formatter -> unit) option
|
||||
(** Like [format_loc_text], but returns the printing functions in 3 separate
|
||||
parts: the file name header, the line context, and the law headers *)
|
||||
|
||||
val no_pos : t
|
||||
(** Placeholder position *)
|
||||
|
@ -102,4 +102,5 @@ let format (ppf : Format.formatter) (suggestions_list : string list) =
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ or ")
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string)
|
||||
ppf suggestions_list
|
||||
ppf suggestions_list;
|
||||
Format.pp_print_string ppf " ?"
|
||||
|
@ -92,10 +92,12 @@ let print_exceptions_graph
|
||||
Ast.ScopeDef.format var ScopeName.format scope;
|
||||
Dependency.ExceptionsDependencies.iter_vertex
|
||||
(fun ex ->
|
||||
Message.result "@[<v>Definitions with label \"%a\":@,%a@]"
|
||||
LabelName.format ex.Dependency.ExceptionVertex.label
|
||||
(RuleName.Map.format_values Pos.format_loc_text)
|
||||
ex.Dependency.ExceptionVertex.rules)
|
||||
Message.result "Definitions with label@ \"%a\":" LabelName.format
|
||||
ex.Dependency.ExceptionVertex.label
|
||||
~extra_pos:
|
||||
(List.map
|
||||
(fun p -> "", p)
|
||||
(RuleName.Map.values ex.Dependency.ExceptionVertex.rules)))
|
||||
g;
|
||||
let tree = build_exception_tree g in
|
||||
Message.result "@[<v>The exception tree structure is as follows:@,@,%a@]"
|
||||
|
@ -688,18 +688,19 @@ module Commands = struct
|
||||
let results =
|
||||
List.sort (fun ((v1, _), _) ((v2, _), _) -> String.compare v1 v2) results
|
||||
in
|
||||
Message.result "Computation successful!%s"
|
||||
(if List.length results > 0 then " Results:" else "");
|
||||
let language =
|
||||
Cli.file_lang (Global.input_src_file options.Global.input_src)
|
||||
in
|
||||
List.iter
|
||||
(fun ((var, _), result) ->
|
||||
Message.result "@[<hov 2>%s@ =@ %a@]" var
|
||||
(if options.Global.debug then Print.expr ~debug:false ()
|
||||
else Print.UserFacing.value language)
|
||||
result)
|
||||
results
|
||||
if results = [] then Message.result "Computation successful!"
|
||||
else
|
||||
Message.results
|
||||
(List.map
|
||||
(fun ((var, _), result) ppf ->
|
||||
Format.fprintf ppf "@[<hov 2>%s@ =@ %a@]" var
|
||||
(if options.Global.debug then Print.expr ~debug:false ()
|
||||
else Print.UserFacing.value language)
|
||||
result)
|
||||
results)
|
||||
|
||||
let interpret_dcalc
|
||||
typed
|
||||
|
@ -265,8 +265,8 @@ let handle_type_error ctx (A.AnyExpr e) t1 t2 =
|
||||
in
|
||||
Message.error ~fmt_pos
|
||||
"Error during typechecking, incompatible types:@\n\
|
||||
@[<v>@{<bold;blue>@<3>%s@} @[<hov>%a@]@,\
|
||||
@{<bold;blue>@<3>%s@} @[<hov>%a@]@]" "┌─⯈" (format_typ ctx) t1 "└─⯈"
|
||||
@[<v>@{<blue>@<2>%s@} @[<hov>%a@]@,\
|
||||
@{<blue>@<2>%s@} @[<hov>%a@]@]" "─➤" (format_typ ctx) t1 "─➤"
|
||||
(format_typ ctx) t2
|
||||
|
||||
let lit_type (lit : A.lit) : naked_typ =
|
||||
|
@ -252,12 +252,14 @@ to ensure that the *syntax* is correct.
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] No scope named Scope0 found
|
||||
|
||||
┌─⯈ doc/syntax/syntax_en.catala_en:94.14-94.20:
|
||||
└──┐
|
||||
94 │ sub1 scope Scope0
|
||||
│ ‾‾‾‾‾‾
|
||||
└─ Metadata declaration
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ No scope named Scope0 found
|
||||
│
|
||||
├─➤ doc/syntax/syntax_en.catala_en:94.14-94.20:
|
||||
│ │
|
||||
│ 94 │ sub1 scope Scope0
|
||||
│ │ ‾‾‾‾‾‾
|
||||
└─ Metadata declaration
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -250,12 +250,14 @@ to ensure that the *syntax* is correct.
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] No scope named Scope0 found
|
||||
|
||||
┌─⯈ doc/syntax/syntax_fr.catala_fr:92.28-92.34:
|
||||
└──┐
|
||||
92 │ sub1 champ d'application Scope0
|
||||
│ ‾‾‾‾‾‾
|
||||
└─ Déclaration des métadonnées
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ No scope named Scope0 found
|
||||
│
|
||||
├─➤ doc/syntax/syntax_fr.catala_fr:92.28-92.34:
|
||||
│ │
|
||||
│ 92 │ sub1 champ d'application Scope0
|
||||
│ │ ‾‾‾‾‾‾
|
||||
└─ Déclaration des métadonnées
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -33,42 +33,48 @@ scope Money:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Dec
|
||||
[ERROR] During evaluation: a value is being used as denominator in a division
|
||||
and it computed to zero.
|
||||
|
||||
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:20.28-20.30:
|
||||
└──┐
|
||||
20 │ definition i equals 1. / 0.
|
||||
│ ‾‾
|
||||
└┬ `Division_by_zero` exception management
|
||||
└─ with decimals
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: a value is being used as denominator in a division and
|
||||
│ it computed to zero.
|
||||
│
|
||||
├─➤ tests/arithmetic/bad/division_by_zero.catala_en:20.28-20.30:
|
||||
│ │
|
||||
│ 20 │ definition i equals 1. / 0.
|
||||
│ │ ‾‾
|
||||
└─ `Division_by_zero` exception management
|
||||
└─ with decimals
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Int
|
||||
[ERROR] During evaluation: a value is being used as denominator in a division
|
||||
and it computed to zero.
|
||||
|
||||
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:10.27-10.28:
|
||||
└──┐
|
||||
10 │ definition i equals 1 / 0
|
||||
│ ‾
|
||||
└┬ `Division_by_zero` exception management
|
||||
└─ with integers
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: a value is being used as denominator in a division and
|
||||
│ it computed to zero.
|
||||
│
|
||||
├─➤ tests/arithmetic/bad/division_by_zero.catala_en:10.27-10.28:
|
||||
│ │
|
||||
│ 10 │ definition i equals 1 / 0
|
||||
│ │ ‾
|
||||
└─ `Division_by_zero` exception management
|
||||
└─ with integers
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Money
|
||||
[ERROR] During evaluation: a value is being used as denominator in a division
|
||||
and it computed to zero.
|
||||
|
||||
┌─⯈ tests/arithmetic/bad/division_by_zero.catala_en:30.31-30.35:
|
||||
└──┐
|
||||
30 │ definition i equals $10.0 / $0.0
|
||||
│ ‾‾‾‾
|
||||
└┬ `Division_by_zero` exception management
|
||||
└─ with money
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: a value is being used as denominator in a division and
|
||||
│ it computed to zero.
|
||||
│
|
||||
├─➤ tests/arithmetic/bad/division_by_zero.catala_en:30.31-30.35:
|
||||
│ │
|
||||
│ 30 │ definition i equals $10.0 / $0.0
|
||||
│ │ ‾‾‾‾
|
||||
└─ `Division_by_zero` exception management
|
||||
└─ with money
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -8,17 +8,20 @@ scope S1:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Please add parentheses to explicit which of these operators should be
|
||||
applied first
|
||||
|
||||
┌─⯈ 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/arithmetic/bad/logical_prio.catala_en:6.58-6.60:
|
||||
└─┐
|
||||
6 │ definition o equals true and (false and true and true) or false
|
||||
│ ‾‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Please add parentheses to explicit which of these operators should be
|
||||
│ applied first
|
||||
│
|
||||
├─➤ 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/arithmetic/bad/logical_prio.catala_en:6.58-6.60:
|
||||
│ │
|
||||
│ 6 │ definition o equals true and (false and true and true) or false
|
||||
│ │ ‾‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,15 +16,20 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] w = 0
|
||||
[RESULT] x = 4
|
||||
[RESULT] y = 4
|
||||
[RESULT] z = 390.0
|
||||
┌─[RESULT]─
|
||||
│ w = 0
|
||||
│ x = 4
|
||||
│ y = 4
|
||||
│ z = 390.0
|
||||
└─
|
||||
```
|
||||
|
@ -46,6 +46,7 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] o = false
|
||||
┌─[RESULT]─
|
||||
│ o = false
|
||||
└─
|
||||
```
|
||||
|
@ -10,12 +10,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] w = 6
|
||||
┌─[RESULT]─
|
||||
│ w = 6
|
||||
└─
|
||||
```
|
||||
|
@ -12,26 +12,28 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] I don't know how to apply operator >= on types integer and money
|
||||
|
||||
┌─⯈ tests/array/bad/fold_error.catala_en:10.78-10.85:
|
||||
└──┐
|
||||
10 │ definition list_high_count equals number of list of m among list such that m >= $7
|
||||
│ ‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ 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/array/bad/fold_error.catala_en:10.83-10.85:
|
||||
└──┐
|
||||
10 │ definition list_high_count equals number of list of m among list such that m >= $7
|
||||
│ ‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ I don't know how to apply operator >= on types integer and money
|
||||
│
|
||||
├─➤ tests/array/bad/fold_error.catala_en:10.78-10.85:
|
||||
│ │
|
||||
│ 10 │ definition list_high_count equals number of list of m among list such that m >= $7
|
||||
│ │ ‾‾‾‾‾‾‾
|
||||
├─ Article
|
||||
│
|
||||
│ Type integer coming from expression:
|
||||
├─➤ 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/array/bad/fold_error.catala_en:10.83-10.85:
|
||||
│ │
|
||||
│ 10 │ definition list_high_count equals number of list of m among list such that m >= $7
|
||||
│ │ ‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -27,21 +27,27 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [$0.00; $9.00; $5.20]
|
||||
┌─[RESULT]─
|
||||
│ x = [$0.00; $9.00; $5.20]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] max = $18.00
|
||||
[RESULT] min = $5.00
|
||||
[RESULT] y = $17.20
|
||||
[RESULT] z = 1
|
||||
┌─[RESULT]─
|
||||
│ max = $18.00
|
||||
│ min = $5.00
|
||||
│ y = $17.20
|
||||
│ z = 1
|
||||
└─
|
||||
```
|
||||
|
@ -33,24 +33,29 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT]
|
||||
x =
|
||||
[
|
||||
S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
|
||||
S { -- id: 2 -- income: $5.20 }
|
||||
]
|
||||
┌─[RESULT]─
|
||||
│ x =
|
||||
│ [
|
||||
│ S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
|
||||
│ S { -- id: 2 -- income: $5.20 }
|
||||
│ ]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] argmax = S { -- id: 1 -- income: $9.00 }
|
||||
[RESULT] argmin = S { -- id: 0 -- income: $0.00 }
|
||||
┌─[RESULT]─
|
||||
│ argmax = S { -- id: 1 -- income: $9.00 }
|
||||
│ argmin = S { -- id: 0 -- income: $0.00 }
|
||||
└─
|
||||
```
|
||||
|
@ -35,8 +35,12 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
@ -90,6 +94,7 @@ let scope S (x: integer|internal|output) =
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope S
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 0
|
||||
┌─[RESULT]─
|
||||
│ x = 0
|
||||
└─
|
||||
```
|
||||
|
@ -14,13 +14,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [0; 1; 2; 3; 4; 5; 6]
|
||||
[RESULT] y = [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
|
||||
┌─[RESULT]─
|
||||
│ x = [0; 1; 2; 3; 4; 5; 6]
|
||||
│ y = [0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10]
|
||||
└─
|
||||
```
|
||||
|
@ -20,18 +20,24 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [$0.00; $9.00; $5.20]
|
||||
┌─[RESULT]─
|
||||
│ x = [$0.00; $9.00; $5.20]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] y = [$9.00; $5.20]
|
||||
┌─[RESULT]─
|
||||
│ y = [$9.00; $5.20]
|
||||
└─
|
||||
```
|
||||
|
@ -21,19 +21,25 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [$0.00; $9.00; $5.20]
|
||||
┌─[RESULT]─
|
||||
│ x = [$0.00; $9.00; $5.20]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] y = [$9.00; $5.20]
|
||||
[RESULT] z = [false; true; true]
|
||||
┌─[RESULT]─
|
||||
│ y = [$9.00; $5.20]
|
||||
│ z = [false; true; true]
|
||||
└─
|
||||
```
|
||||
|
@ -33,24 +33,29 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT]
|
||||
x =
|
||||
[
|
||||
S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
|
||||
S { -- id: 2 -- income: $5.20 }
|
||||
]
|
||||
┌─[RESULT]─
|
||||
│ x =
|
||||
│ [
|
||||
│ S { -- id: 0 -- income: $0.00 }; S { -- id: 1 -- income: $9.00 };
|
||||
│ S { -- id: 2 -- income: $5.20 }
|
||||
│ ]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] argmax = S { -- id: 1 -- income: $9.00 }
|
||||
[RESULT] argmin = S { -- id: 0 -- income: $0.00 }
|
||||
┌─[RESULT]─
|
||||
│ argmax = S { -- id: 1 -- income: $9.00 }
|
||||
│ argmin = S { -- id: 0 -- income: $0.00 }
|
||||
└─
|
||||
```
|
||||
|
@ -14,13 +14,18 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [$4.00; $8.00]
|
||||
[RESULT] z = [false; true]
|
||||
┌─[RESULT]─
|
||||
│ x = [$4.00; $8.00]
|
||||
│ z = [false; true]
|
||||
└─
|
||||
```
|
||||
|
@ -25,21 +25,27 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [0; 9; 64]
|
||||
┌─[RESULT]─
|
||||
│ x = [0; 9; 64]
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope B
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] v = 3
|
||||
[RESULT] w = true
|
||||
[RESULT] y = true
|
||||
[RESULT] z = false
|
||||
┌─[RESULT]─
|
||||
│ v = 3
|
||||
│ w = true
|
||||
│ y = true
|
||||
│ z = false
|
||||
└─
|
||||
```
|
||||
|
@ -14,13 +14,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] w = false
|
||||
[RESULT] x = [0; 9; 64]
|
||||
┌─[RESULT]─
|
||||
│ w = false
|
||||
│ x = [0; 9; 64]
|
||||
└─
|
||||
```
|
||||
|
@ -12,12 +12,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = [0; 4; 8]
|
||||
┌─[RESULT]─
|
||||
│ x = [0; 4; 8]
|
||||
└─
|
||||
```
|
||||
|
@ -12,29 +12,31 @@ scope Foo:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Foo
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
|
||||
While typechecking the following expression:
|
||||
┌─⯈ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
|
||||
└─┐
|
||||
9 │ assertion x
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
Type integer is coming from:
|
||||
┌─⯈ tests/bool/bad/bad_assert.catala_en:5.20-5.27:
|
||||
└─┐
|
||||
5 │ output x content integer
|
||||
│ ‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
|
||||
Type bool is coming from:
|
||||
┌─⯈ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
|
||||
└─┐
|
||||
9 │ assertion x
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Error during typechecking, incompatible types:
|
||||
│ ─➤ integer
|
||||
│ ─➤ bool
|
||||
│
|
||||
│ While typechecking the following expression:
|
||||
├─➤ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
|
||||
│ │
|
||||
│ 9 │ assertion x
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
│ Type integer is coming from:
|
||||
├─➤ tests/bool/bad/bad_assert.catala_en:5.20-5.27:
|
||||
│ │
|
||||
│ 5 │ output x content integer
|
||||
│ │ ‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
│ Type bool is coming from:
|
||||
├─➤ tests/bool/bad/bad_assert.catala_en:9.13-9.14:
|
||||
│ │
|
||||
│ 9 │ assertion x
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -10,22 +10,24 @@ scope TestXorWithInt:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
|
||||
This expression has type integer:
|
||||
┌─⯈ 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/bool/bad/test_xor_with_int.catala_en:8.33-8.36:
|
||||
└─┐
|
||||
8 │ definition test_var equals 10 xor 20
|
||||
│ ‾‾‾
|
||||
└─ 'xor' should be a boolean operator
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Error during typechecking, incompatible types:
|
||||
│ ─➤ integer
|
||||
│ ─➤ bool
|
||||
│
|
||||
│ This expression has type integer:
|
||||
├─➤ 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/bool/bad/test_xor_with_int.catala_en:8.33-8.36:
|
||||
│ │
|
||||
│ 8 │ definition test_var equals 10 xor 20
|
||||
│ │ ‾‾‾
|
||||
└─ 'xor' should be a boolean operator
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -15,8 +15,12 @@ scope TestBool:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
@ -43,9 +47,10 @@ TestBool
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope TestBool
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] bar = 1
|
||||
[RESULT] foo = true
|
||||
┌─[RESULT]─
|
||||
│ bar = 1
|
||||
│ foo = true
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
|
@ -12,12 +12,17 @@ scope TestBool:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope TestBool
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] foo = true
|
||||
┌─[RESULT]─
|
||||
│ foo = true
|
||||
└─
|
||||
```
|
||||
|
@ -18,15 +18,20 @@ scope TestXor:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope TestXor
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] f_xor_f = false
|
||||
[RESULT] f_xor_t = true
|
||||
[RESULT] t_xor_f = true
|
||||
[RESULT] t_xor_t = false
|
||||
┌─[RESULT]─
|
||||
│ f_xor_f = false
|
||||
│ f_xor_t = true
|
||||
│ t_xor_f = true
|
||||
│ t_xor_t = false
|
||||
└─
|
||||
```
|
||||
|
@ -25,16 +25,19 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[ERROR] You cannot set multiple date rounding modes
|
||||
|
||||
┌─⯈ tests/date/bad/rounding_option_conflict.catala_en:10.14-10.24:
|
||||
└──┐
|
||||
10 │ date round decreasing
|
||||
│ ‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
┌─⯈ tests/date/bad/rounding_option_conflict.catala_en:12.14-12.24:
|
||||
└──┐
|
||||
12 │ date round increasing
|
||||
│ ‾‾‾‾‾‾‾‾‾‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ You cannot set multiple date rounding modes
|
||||
│
|
||||
├─➤ tests/date/bad/rounding_option_conflict.catala_en:10.14-10.24:
|
||||
│ │
|
||||
│ 10 │ date round decreasing
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
├─➤ tests/date/bad/rounding_option_conflict.catala_en:12.14-12.24:
|
||||
│ │
|
||||
│ 12 │ date round increasing
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,6 +12,10 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[ERROR] Unexpected error: Dates_calc.Dates.AmbiguousComputation
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Unexpected error: Dates_calc.Dates.AmbiguousComputation
|
||||
│
|
||||
└─
|
||||
#return code 125#
|
||||
```
|
||||
|
@ -12,6 +12,10 @@ champ d'application Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[ERROR] Unexpected error: Dates_calc.Dates.AmbiguousComputation
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Unexpected error: Dates_calc.Dates.AmbiguousComputation
|
||||
│
|
||||
└─
|
||||
#return code 125#
|
||||
```
|
||||
|
@ -8,23 +8,26 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] I don't know how to apply operator <= on types date and duration
|
||||
|
||||
┌─⯈ 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/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/date/bad/substraction.catala_en:6.47-6.52:
|
||||
└─┐
|
||||
6 │ definition o equals |2024-01-16| - 0 day <= 0 day
|
||||
│ ‾‾‾‾‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ I don't know how to apply operator <= on types date and duration
|
||||
│
|
||||
├─➤ 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/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/date/bad/substraction.catala_en:6.47-6.52:
|
||||
│ │
|
||||
│ 6 │ definition o equals |2024-01-16| - 0 day <= 0 day
|
||||
│ │ ‾‾‾‾‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -42,56 +42,64 @@ scope Ge:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Ge
|
||||
[ERROR] During evaluation: ambiguous comparison between durations in
|
||||
different units (e.g. months vs. days).
|
||||
|
||||
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:40.31-40.33:
|
||||
└──┐
|
||||
40 │ definition d equals 1 month >= 2 day
|
||||
│ ‾‾
|
||||
└┬ `UncomparableDurations` exception management
|
||||
└─ `>=` operator
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: ambiguous comparison between durations in different
|
||||
│ units (e.g. months vs. days).
|
||||
│
|
||||
├─➤ tests/date/bad/uncomparable_duration.catala_en:40.31-40.33:
|
||||
│ │
|
||||
│ 40 │ definition d equals 1 month >= 2 day
|
||||
│ │ ‾‾
|
||||
└─ `UncomparableDurations` exception management
|
||||
└─ `>=` operator
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Gt
|
||||
[ERROR] During evaluation: ambiguous comparison between durations in
|
||||
different units (e.g. months vs. days).
|
||||
|
||||
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:30.31-30.32:
|
||||
└──┐
|
||||
30 │ definition d equals 1 month > 2 day
|
||||
│ ‾
|
||||
└┬ `UncomparableDurations` exception management
|
||||
└─ `<=` operator
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: ambiguous comparison between durations in different
|
||||
│ units (e.g. months vs. days).
|
||||
│
|
||||
├─➤ tests/date/bad/uncomparable_duration.catala_en:30.31-30.32:
|
||||
│ │
|
||||
│ 30 │ definition d equals 1 month > 2 day
|
||||
│ │ ‾
|
||||
└─ `UncomparableDurations` exception management
|
||||
└─ `<=` operator
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Le
|
||||
[ERROR] During evaluation: ambiguous comparison between durations in
|
||||
different units (e.g. months vs. days).
|
||||
|
||||
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:20.31-20.33:
|
||||
└──┐
|
||||
20 │ definition d equals 1 month <= 2 day
|
||||
│ ‾‾
|
||||
└┬ `UncomparableDurations` exception management
|
||||
└─ `<=` operator
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: ambiguous comparison between durations in different
|
||||
│ units (e.g. months vs. days).
|
||||
│
|
||||
├─➤ tests/date/bad/uncomparable_duration.catala_en:20.31-20.33:
|
||||
│ │
|
||||
│ 20 │ definition d equals 1 month <= 2 day
|
||||
│ │ ‾‾
|
||||
└─ `UncomparableDurations` exception management
|
||||
└─ `<=` operator
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Lt
|
||||
[ERROR] During evaluation: ambiguous comparison between durations in
|
||||
different units (e.g. months vs. days).
|
||||
|
||||
┌─⯈ tests/date/bad/uncomparable_duration.catala_en:10.31-10.32:
|
||||
└──┐
|
||||
10 │ definition d equals 1 month < 2 day
|
||||
│ ‾
|
||||
└┬ `UncomparableDurations` exception management
|
||||
└─ `<` operator
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: ambiguous comparison between durations in different
|
||||
│ units (e.g. months vs. days).
|
||||
│
|
||||
├─➤ tests/date/bad/uncomparable_duration.catala_en:10.31-10.32:
|
||||
│ │
|
||||
│ 10 │ definition d equals 1 month < 2 day
|
||||
│ │ ‾
|
||||
└─ `UncomparableDurations` exception management
|
||||
└─ `<` operator
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -27,18 +27,23 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] m = [11874 days]
|
||||
[RESULT] m2 = [6 months]
|
||||
[RESULT] x = 2019-01-01
|
||||
[RESULT] y = 2002-09-30
|
||||
[RESULT] z = true
|
||||
[RESULT] z2 = true
|
||||
[RESULT] z3 = [5937 days]
|
||||
┌─[RESULT]─
|
||||
│ m = [11874 days]
|
||||
│ m2 = [6 months]
|
||||
│ x = 2019-01-01
|
||||
│ y = 2002-09-30
|
||||
│ z = true
|
||||
│ z2 = true
|
||||
│ z3 = [5937 days]
|
||||
└─
|
||||
```
|
||||
|
@ -26,12 +26,17 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] r = true
|
||||
┌─[RESULT]─
|
||||
│ r = true
|
||||
└─
|
||||
```
|
||||
|
@ -26,12 +26,17 @@ champ d'application Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] r = vrai
|
||||
┌─[RESULT]─
|
||||
│ r = vrai
|
||||
└─
|
||||
```
|
||||
|
@ -16,14 +16,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 2019-01-01
|
||||
[RESULT] y = 2002-09-30
|
||||
[RESULT] z = [5937 days]
|
||||
┌─[RESULT]─
|
||||
│ x = 2019-01-01
|
||||
│ y = 2002-09-30
|
||||
│ z = [5937 days]
|
||||
└─
|
||||
```
|
||||
|
@ -18,17 +18,21 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT]
|
||||
a =
|
||||
-0.000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,078,695,580,959,228,473,468…
|
||||
[RESULT] x = 84.648,665,652,656,896,23
|
||||
[RESULT] y = -4.368,297,787,053,206,549,8
|
||||
[RESULT] z = 654,265,429,805,103,220,650,980,650.5…
|
||||
┌─[RESULT]─
|
||||
│ a =
|
||||
│ -0.000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,078,695,580,959,228,473,468…
|
||||
│ x = 84.648,665,652,656,896,23
|
||||
│ y = -4.368,297,787,053,206,549,8
|
||||
│ z = 654,265,429,805,103,220,650,980,650.5…
|
||||
└─
|
||||
```
|
||||
|
@ -18,15 +18,20 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 84.648,665
|
||||
[RESULT] x1 = 85.0
|
||||
[RESULT] y = 4.368,297
|
||||
[RESULT] y1 = 4.0
|
||||
┌─[RESULT]─
|
||||
│ x = 84.648,665
|
||||
│ x1 = 85.0
|
||||
│ y = 4.368,297
|
||||
│ y1 = 4.0
|
||||
└─
|
||||
```
|
||||
|
@ -18,15 +18,20 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] k = 0.333,333,333,333,333,333,33…
|
||||
[RESULT] x = 84.648,665
|
||||
[RESULT] y = 4.368,297
|
||||
[RESULT] z = 19.377,955,528,206,987,757…
|
||||
┌─[RESULT]─
|
||||
│ k = 0.333,333,333,333,333,333,33…
|
||||
│ x = 84.648,665
|
||||
│ y = 4.368,297
|
||||
│ z = 19.377,955,528,206,987,757…
|
||||
└─
|
||||
```
|
||||
|
@ -15,13 +15,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 4.0
|
||||
[RESULT] y = 1.04
|
||||
┌─[RESULT]─
|
||||
│ x = 4.0
|
||||
│ y = 1.04
|
||||
└─
|
||||
```
|
||||
|
@ -11,21 +11,25 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[WARNING] In scope "A", the variable "y" is declared but never defined;
|
||||
did you forget something?
|
||||
|
||||
┌─⯈ tests/default/bad/empty.catala_en:6.10-6.11:
|
||||
└─┐
|
||||
6 │ output y content boolean
|
||||
│ ‾
|
||||
└─ Article
|
||||
[ERROR] During evaluation: no applicable rule to define this variable in this
|
||||
situation.
|
||||
|
||||
┌─⯈ tests/default/bad/empty.catala_en:6.10-6.11:
|
||||
└─┐
|
||||
6 │ output y content boolean
|
||||
│ ‾
|
||||
└─ Article
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ In scope "A", the variable "y" is declared but never defined;
|
||||
│ did you forget something?
|
||||
│
|
||||
├─➤ tests/default/bad/empty.catala_en:6.10-6.11:
|
||||
│ │
|
||||
│ 6 │ output y content boolean
|
||||
│ │ ‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: no applicable rule to define this variable in this
|
||||
│ situation.
|
||||
│
|
||||
├─➤ tests/default/bad/empty.catala_en:6.10-6.11:
|
||||
│ │
|
||||
│ 6 │ output y content boolean
|
||||
│ │ ‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -14,13 +14,15 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] During evaluation: no applicable rule to define this variable in this
|
||||
situation.
|
||||
|
||||
┌─⯈ tests/default/bad/empty_with_rules.catala_en:5.10-5.11:
|
||||
└─┐
|
||||
5 │ output x content integer
|
||||
│ ‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: no applicable rule to define this variable in this
|
||||
│ situation.
|
||||
│
|
||||
├─➤ tests/default/bad/empty_with_rules.catala_en:5.10-5.11:
|
||||
│ │
|
||||
│ 5 │ output x content integer
|
||||
│ │ ‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -11,18 +11,21 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Syntax error at "="
|
||||
» expected 'under condition' followed by a condition, 'equals' followed by
|
||||
the definition body, or the rest of the variable qualified name
|
||||
Those are valid at this point: "of", "state", "equals", "under condition",
|
||||
"."
|
||||
|
||||
Last good token
|
||||
┌─⯈ tests/default/bad/typing_or_logical_error.catala_en:8.13-8.29:
|
||||
└─┐
|
||||
8 │ definition wrong_definition = 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
Maybe you wanted to write : "."
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Syntax error at "="
|
||||
│ » expected 'under condition' followed by a condition, 'equals' followed by
|
||||
│ the definition body, or the rest of the variable qualified name
|
||||
│ Those are valid at this point: "of", "state", "equals", "under condition",
|
||||
│ "."
|
||||
│
|
||||
│ Last good token
|
||||
├─➤ tests/default/bad/typing_or_logical_error.catala_en:8.13-8.29:
|
||||
│ │
|
||||
│ 8 │ definition wrong_definition = 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
│ Maybe you wanted to write : "." ?
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -13,36 +13,47 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[WARNING] These definitions have identical justifications and consequences;
|
||||
is it a mistake?
|
||||
|
||||
┌─⯈ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
|
||||
└─┐
|
||||
9 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
┌─⯈ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
|
||||
└─┐
|
||||
6 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ These definitions have identical justifications and consequences;
|
||||
│ is it a mistake?
|
||||
│
|
||||
├─➤ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
|
||||
│ │
|
||||
│ 9 │ definition w equals 3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
├─➤ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
|
||||
│ │
|
||||
│ 6 │ definition w equals 3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[WARNING] These definitions have identical justifications and consequences;
|
||||
is it a mistake?
|
||||
|
||||
┌─⯈ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
|
||||
└─┐
|
||||
9 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
┌─⯈ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
|
||||
└─┐
|
||||
6 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] w = 3
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ These definitions have identical justifications and consequences;
|
||||
│ is it a mistake?
|
||||
│
|
||||
├─➤ tests/default/good/mutliple_definitions.catala_en:9.3-9.15:
|
||||
│ │
|
||||
│ 9 │ definition w equals 3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
├─➤ tests/default/good/mutliple_definitions.catala_en:6.3-6.15:
|
||||
│ │
|
||||
│ 6 │ definition w equals 3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ w = 3
|
||||
└─
|
||||
```
|
||||
|
@ -16,13 +16,15 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] This constructor name is ambiguous, it can belong to E or F.
|
||||
Disambiguate it by prefixing it with the enum name.
|
||||
|
||||
┌─⯈ tests/enum/bad/ambiguous_cases.catala_en:14.23-14.28:
|
||||
└──┐
|
||||
14 │ definition e equals Case1
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This constructor name is ambiguous, it can belong to E or F.
|
||||
│ Disambiguate it by prefixing it with the enum name.
|
||||
│
|
||||
├─➤ tests/enum/bad/ambiguous_cases.catala_en:14.23-14.28:
|
||||
│ │
|
||||
│ 14 │ definition e equals Case1
|
||||
│ │ ‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -17,13 +17,15 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Couldn't infer the enumeration name from lonely wildcard (wildcard
|
||||
cannot be used as single match case)
|
||||
|
||||
┌─⯈ tests/enum/bad/ambiguous_wildcard.catala_en:15.5-15.21:
|
||||
└──┐
|
||||
15 │ -- anything : 31
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ 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/enum/bad/ambiguous_wildcard.catala_en:15.5-15.21:
|
||||
│ │
|
||||
│ 15 │ -- anything : 31
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Wildcard cannot be used as single match case
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -20,18 +20,20 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] The constructor Case3 has been matched twice:
|
||||
|
||||
┌─⯈ tests/enum/bad/duplicate_case.catala_en:18.16-18.20:
|
||||
└──┐
|
||||
18 │ -- Case3 : true
|
||||
│ ‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
┌─⯈ tests/enum/bad/duplicate_case.catala_en:17.16-17.21:
|
||||
└──┐
|
||||
17 │ -- Case3 : false
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ The constructor Case3 has been matched twice:
|
||||
│
|
||||
├─➤ tests/enum/bad/duplicate_case.catala_en:18.16-18.20:
|
||||
│ │
|
||||
│ 18 │ -- Case3 : true
|
||||
│ │ ‾‾‾‾
|
||||
├─ Article
|
||||
│
|
||||
├─➤ tests/enum/bad/duplicate_case.catala_en:17.16-17.21:
|
||||
│ │
|
||||
│ 17 │ -- Case3 : false
|
||||
│ │ ‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -9,13 +9,15 @@ 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.
|
||||
|
||||
┌─⯈ tests/enum/bad/empty.catala_en:4.25-4.28:
|
||||
└─┐
|
||||
4 │ declaration enumeration Foo:
|
||||
│ ‾‾‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ The enum Foo does not have any cases;
|
||||
│ give it some for Catala to be able to accept it.
|
||||
│
|
||||
├─➤ tests/enum/bad/empty.catala_en:4.25-4.28:
|
||||
│ │
|
||||
│ 4 │ declaration enumeration Foo:
|
||||
│ │ ‾‾‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -18,24 +18,28 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[WARNING] The constructor "Case3" of enumeration "E" is never used;
|
||||
maybe it's unnecessary?
|
||||
|
||||
┌─⯈ tests/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/enum/bad/missing_case.catala_en:14.25-16.22:
|
||||
└──┐
|
||||
14 │ definition out equals match e with pattern
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
15 │ -- Case1 of i : i = 0
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
16 │ -- Case2 of b : b
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ The constructor "Case3" of enumeration "E" is never used;
|
||||
│ maybe it's unnecessary?
|
||||
│
|
||||
├─➤ tests/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/enum/bad/missing_case.catala_en:14.25-16.22:
|
||||
│ │
|
||||
│ 14 │ definition out equals match e with pattern
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 15 │ -- Case1 of i : i = 0
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 16 │ -- Case2 of b : b
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -38,44 +38,48 @@ scope Middle_case:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope First_case
|
||||
[ERROR] Wildcard must be the last match case
|
||||
|
||||
Not ending wildcard:
|
||||
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
└──┐
|
||||
19 │ -- anything : 31
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└┬ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
|
||||
Next reachable case:
|
||||
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
|
||||
└──┐
|
||||
20 │ -- Case2 : 42
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└┬ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Wildcard must be the last match case
|
||||
│
|
||||
│ Not ending wildcard:
|
||||
├─➤ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
│ │
|
||||
│ 19 │ -- anything : 31
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Wildcard must be the last case
|
||||
│ └─ Wildcard can't be the first case
|
||||
│
|
||||
│ Next reachable case:
|
||||
├─➤ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
|
||||
│ │
|
||||
│ 20 │ -- Case2 : 42
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Middle_case
|
||||
[ERROR] Wildcard must be the last match case
|
||||
|
||||
Not ending wildcard:
|
||||
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
└──┐
|
||||
19 │ -- anything : 31
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└┬ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
|
||||
Next reachable case:
|
||||
┌─⯈ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
|
||||
└──┐
|
||||
20 │ -- Case2 : 42
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└┬ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Wildcard must be the last match case
|
||||
│
|
||||
│ Not ending wildcard:
|
||||
├─➤ tests/enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
│ │
|
||||
│ 19 │ -- anything : 31
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Wildcard must be the last case
|
||||
│ └─ Wildcard can't be the first case
|
||||
│
|
||||
│ Next reachable case:
|
||||
├─➤ tests/enum/bad/not_ending_wildcard.catala_en:20.5-20.18:
|
||||
│ │
|
||||
│ 20 │ -- Case2 : 42
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Wildcard must be the last case
|
||||
└─ Wildcard can't be the first case
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -30,29 +30,31 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
While typechecking the following expression:
|
||||
┌─⯈ 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/enum/bad/quick_pattern_2.catala_en:17.21-17.22:
|
||||
└──┐
|
||||
17 │ context x content E
|
||||
│ ‾
|
||||
└─ Article
|
||||
|
||||
Type F is coming from:
|
||||
┌─⯈ tests/enum/bad/quick_pattern_2.catala_en:28.23-28.43:
|
||||
└──┐
|
||||
28 │ definition y equals x with pattern Case3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Error during typechecking, incompatible types:
|
||||
│ ─➤ E
|
||||
│ ─➤ F
|
||||
│
|
||||
│ While typechecking the following expression:
|
||||
├─➤ 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/enum/bad/quick_pattern_2.catala_en:17.21-17.22:
|
||||
│ │
|
||||
│ 17 │ context x content E
|
||||
│ │ ‾
|
||||
├─ Article
|
||||
│
|
||||
│ Type F is coming from:
|
||||
├─➤ tests/enum/bad/quick_pattern_2.catala_en:28.23-28.43:
|
||||
│ │
|
||||
│ 28 │ definition y equals x with pattern Case3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -20,29 +20,31 @@ definition y equals x with pattern Case3
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
While typechecking the following expression:
|
||||
┌─⯈ 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/enum/bad/quick_pattern_3.catala_en:13.19-13.20:
|
||||
└──┐
|
||||
13 │ context x content E
|
||||
│ ‾
|
||||
└─ Article
|
||||
|
||||
Type F is coming from:
|
||||
┌─⯈ tests/enum/bad/quick_pattern_3.catala_en:18.21-18.41:
|
||||
└──┐
|
||||
18 │ definition y equals x with pattern Case3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Error during typechecking, incompatible types:
|
||||
│ ─➤ E
|
||||
│ ─➤ F
|
||||
│
|
||||
│ While typechecking the following expression:
|
||||
├─➤ 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/enum/bad/quick_pattern_3.catala_en:13.19-13.20:
|
||||
│ │
|
||||
│ 13 │ context x content E
|
||||
│ │ ‾
|
||||
├─ Article
|
||||
│
|
||||
│ Type F is coming from:
|
||||
├─➤ tests/enum/bad/quick_pattern_3.catala_en:18.21-18.41:
|
||||
│ │
|
||||
│ 18 │ definition y equals x with pattern Case3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -19,29 +19,31 @@ definition y equals x with pattern Case3
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
While typechecking the following expression:
|
||||
┌─⯈ 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/enum/bad/quick_pattern_4.catala_en:12.19-12.20:
|
||||
└──┐
|
||||
12 │ context x content E
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
Type F is coming from:
|
||||
┌─⯈ tests/enum/bad/quick_pattern_4.catala_en:17.21-17.41:
|
||||
└──┐
|
||||
17 │ definition y equals x with pattern Case3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Error during typechecking, incompatible types:
|
||||
│ ─➤ E
|
||||
│ ─➤ F
|
||||
│
|
||||
│ While typechecking the following expression:
|
||||
├─➤ 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/enum/bad/quick_pattern_4.catala_en:12.19-12.20:
|
||||
│ │
|
||||
│ 12 │ context x content E
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
│ Type F is coming from:
|
||||
├─➤ tests/enum/bad/quick_pattern_4.catala_en:17.21-17.41:
|
||||
│ │
|
||||
│ 17 │ definition y equals x with pattern Case3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -17,17 +17,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] The name of this constructor has not been defined before
|
||||
(it's probably a typographical error).
|
||||
|
||||
Here is your code :
|
||||
┌─⯈ tests/enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
|
||||
└──┐
|
||||
15 │ definition y equals x with pattern Case3
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
Maybe you wanted to write : "Case1",
|
||||
or "Case2"
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ The name of this constructor has not been defined before
|
||||
│ (it's probably a typographical error).
|
||||
│
|
||||
│ Here is your code :
|
||||
├─➤ tests/enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
|
||||
│ │
|
||||
│ 15 │ definition y equals x with pattern Case3
|
||||
│ │ ‾‾‾‾‾
|
||||
├─ Article
|
||||
│
|
||||
│ Maybe you wanted to write : "Case1", or "Case2" ?
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -23,13 +23,15 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] This case matches a constructor of enumeration E but previous cases
|
||||
were matching constructors of enumeration F
|
||||
|
||||
┌─⯈ tests/enum/bad/too_many_cases.catala_en:21.8-21.13:
|
||||
└──┐
|
||||
21 │ -- Case4 : true
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This case matches a constructor of enumeration E but previous cases were
|
||||
│ matching constructors of enumeration F
|
||||
│
|
||||
├─➤ tests/enum/bad/too_many_cases.catala_en:21.8-21.13:
|
||||
│ │
|
||||
│ 21 │ -- Case4 : true
|
||||
│ │ ‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -19,15 +19,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[WARNING] Unreachable match case, all constructors of the enumeration E are
|
||||
already specified
|
||||
|
||||
┌─⯈ tests/enum/bad/useless_wildcard.catala_en:17.5-17.21:
|
||||
└──┐
|
||||
17 │ -- anything : 31
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Useless wildcard
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = Case1 ()
|
||||
[RESULT] y = 42
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ Unreachable match case, all constructors of the enumeration E are already
|
||||
│ specified
|
||||
│
|
||||
├─➤ tests/enum/bad/useless_wildcard.catala_en:17.5-17.21:
|
||||
│ │
|
||||
│ 17 │ -- anything : 31
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Useless wildcard
|
||||
┌─[RESULT]─
|
||||
│ x = Case1 ()
|
||||
│ y = 42
|
||||
└─
|
||||
```
|
||||
|
@ -13,16 +13,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] The name of this constructor has not been defined before
|
||||
(it's probably a typographical error).
|
||||
|
||||
Here is your code :
|
||||
┌─⯈ tests/enum/bad/wrong_cons.catala_en:11.23-11.28:
|
||||
└──┐
|
||||
11 │ definition e equals Case2
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
Maybe you wanted to write : "Case1"
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ The name of this constructor has not been defined before
|
||||
│ (it's probably a typographical error).
|
||||
│
|
||||
│ Here is your code :
|
||||
├─➤ tests/enum/bad/wrong_cons.catala_en:11.23-11.28:
|
||||
│ │
|
||||
│ 11 │ definition e equals Case2
|
||||
│ │ ‾‾‾‾‾
|
||||
├─ Article
|
||||
│
|
||||
│ Maybe you wanted to write : "Case1" ?
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -25,14 +25,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] e = Case1 ()
|
||||
[RESULT] f = Case1 2
|
||||
[RESULT] x = 2
|
||||
┌─[RESULT]─
|
||||
│ e = Case1 ()
|
||||
│ f = Case1 2
|
||||
│ x = 2
|
||||
└─
|
||||
```
|
||||
|
@ -20,14 +20,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = Case1 2
|
||||
[RESULT] y = true
|
||||
[RESULT] z = false
|
||||
┌─[RESULT]─
|
||||
│ x = Case1 2
|
||||
│ y = true
|
||||
│ z = false
|
||||
└─
|
||||
```
|
||||
|
@ -20,13 +20,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = Case1 2
|
||||
[RESULT] y = 42
|
||||
┌─[RESULT]─
|
||||
│ x = Case1 2
|
||||
│ y = 42
|
||||
└─
|
||||
```
|
||||
|
@ -40,20 +40,26 @@ scope Simple_case_2:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Simple_case_2
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = Case3 ()
|
||||
[RESULT] y = 31
|
||||
┌─[RESULT]─
|
||||
│ x = Case3 ()
|
||||
│ y = 31
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Simple_case
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = Case1 2
|
||||
[RESULT] y = 31
|
||||
┌─[RESULT]─
|
||||
│ x = Case1 2
|
||||
│ y = 31
|
||||
└─
|
||||
```
|
||||
|
@ -15,30 +15,32 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] This exception can refer to several definitions. Try using labels to
|
||||
disambiguate
|
||||
|
||||
Ambiguous exception
|
||||
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:12.3-13.15:
|
||||
└──┐
|
||||
12 │ exception
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
13 │ definition x equals 2
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
|
||||
Candidate definition
|
||||
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:10.14-10.15:
|
||||
└──┐
|
||||
10 │ definition x equals 1
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
Candidate definition
|
||||
┌─⯈ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:8.14-8.15:
|
||||
└─┐
|
||||
8 │ definition x equals 0
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This exception can refer to several definitions. Try using labels to
|
||||
│ disambiguate
|
||||
│
|
||||
│ Ambiguous exception
|
||||
├─➤ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:12.3-13.15:
|
||||
│ │
|
||||
│ 12 │ exception
|
||||
│ │ ‾‾‾‾‾‾‾‾‾
|
||||
│ 13 │ definition x equals 2
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
│ Candidate definition
|
||||
├─➤ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:10.14-10.15:
|
||||
│ │
|
||||
│ 10 │ definition x equals 1
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
│ Candidate definition
|
||||
├─➤ tests/exception/bad/ambiguous_unlabeled_exception.catala_en:8.14-8.15:
|
||||
│ │
|
||||
│ 8 │ definition x equals 0
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -15,12 +15,14 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Unknown label for the scope variable x: "base_y"
|
||||
|
||||
┌─⯈ tests/exception/bad/dangling_exception.catala_en:12.13-12.19:
|
||||
└──┐
|
||||
12 │ exception base_y
|
||||
│ ‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Unknown label for the scope variable x: "base_y"
|
||||
│
|
||||
├─➤ tests/exception/bad/dangling_exception.catala_en:12.13-12.19:
|
||||
│ │
|
||||
│ 12 │ exception base_y
|
||||
│ │ ‾‾‾‾‾‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -20,35 +20,38 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope 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/exception/bad/exceptions_cycle.catala_en:8.3-10.15:
|
||||
└──┐
|
||||
8 │ label base_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
9 │ exception exception_exception_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
10 │ definition x equals 0
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
┌─⯈ tests/exception/bad/exceptions_cycle.catala_en:12.3-14.15:
|
||||
└──┐
|
||||
12 │ label exception_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
13 │ exception base_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
14 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
┌─⯈ tests/exception/bad/exceptions_cycle.catala_en:16.3-18.15:
|
||||
└──┐
|
||||
16 │ label exception_exception_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
17 │ exception exception_x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
18 │ definition x equals 2
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
┌─[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/exception/bad/exceptions_cycle.catala_en:8.3-10.15:
|
||||
│ │
|
||||
│ 8 │ label base_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 9 │ exception exception_exception_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 10 │ definition x equals 0
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
├─➤ tests/exception/bad/exceptions_cycle.catala_en:12.3-14.15:
|
||||
│ │
|
||||
│ 12 │ label exception_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 13 │ exception base_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 14 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│
|
||||
├─➤ tests/exception/bad/exceptions_cycle.catala_en:16.3-18.15:
|
||||
│ │
|
||||
│ 16 │ label exception_exception_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 17 │ exception exception_x
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
│ 18 │ definition x equals 2
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -11,14 +11,16 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] This exception does not have a corresponding definition
|
||||
|
||||
┌─⯈ tests/exception/bad/missing_unlabeled_definition.catala_en:8.3-9.15:
|
||||
└─┐
|
||||
8 │ exception
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
9 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This exception does not have a corresponding definition
|
||||
│
|
||||
├─➤ tests/exception/bad/missing_unlabeled_definition.catala_en:8.3-9.15:
|
||||
│ │
|
||||
│ 8 │ exception
|
||||
│ │ ‾‾‾‾‾‾‾‾‾
|
||||
│ 9 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -21,30 +21,32 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] This exception can refer to several definitions. Try using labels to
|
||||
disambiguate
|
||||
|
||||
Ambiguous exception
|
||||
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:18.3-19.15:
|
||||
└──┐
|
||||
18 │ exception
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
19 │ definition y equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
|
||||
Candidate definition
|
||||
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:16.14-16.15:
|
||||
└──┐
|
||||
16 │ definition y equals 4
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
Candidate definition
|
||||
┌─⯈ tests/exception/bad/one_ambiguous_exception.catala_en:14.14-14.15:
|
||||
└──┐
|
||||
14 │ definition y equals 2
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This exception can refer to several definitions. Try using labels to
|
||||
│ disambiguate
|
||||
│
|
||||
│ Ambiguous exception
|
||||
├─➤ tests/exception/bad/one_ambiguous_exception.catala_en:18.3-19.15:
|
||||
│ │
|
||||
│ 18 │ exception
|
||||
│ │ ‾‾‾‾‾‾‾‾‾
|
||||
│ 19 │ definition y equals 3
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
│ Candidate definition
|
||||
├─➤ tests/exception/bad/one_ambiguous_exception.catala_en:16.14-16.15:
|
||||
│ │
|
||||
│ 16 │ definition y equals 4
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
│ Candidate definition
|
||||
├─➤ tests/exception/bad/one_ambiguous_exception.catala_en:14.14-14.15:
|
||||
│ │
|
||||
│ 14 │ definition y equals 2
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,12 +12,14 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] Cannot define rule as an exception to itself
|
||||
|
||||
┌─⯈ tests/exception/bad/self_exception.catala_en:9.13-9.19:
|
||||
└─┐
|
||||
9 │ exception base_y
|
||||
│ ‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Cannot define rule as an exception to itself
|
||||
│
|
||||
├─➤ tests/exception/bad/self_exception.catala_en:9.13-9.19:
|
||||
│ │
|
||||
│ 9 │ exception base_y
|
||||
│ │ ‾‾‾‾‾‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -17,19 +17,21 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[ERROR] During evaluation: conflict between multiple valid consequences for
|
||||
assigning the same variable.
|
||||
|
||||
┌─⯈ tests/exception/bad/two_exceptions.catala_en:12.23-12.24:
|
||||
└──┐
|
||||
12 │ definition x equals 1
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
┌─⯈ tests/exception/bad/two_exceptions.catala_en:15.23-15.24:
|
||||
└──┐
|
||||
15 │ definition x equals 2
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: conflict between multiple valid consequences for
|
||||
│ assigning the same variable.
|
||||
│
|
||||
├─➤ tests/exception/bad/two_exceptions.catala_en:12.23-12.24:
|
||||
│ │
|
||||
│ 12 │ definition x equals 1
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
├─➤ tests/exception/bad/two_exceptions.catala_en:15.23-15.24:
|
||||
│ │
|
||||
│ 15 │ definition x equals 2
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -19,11 +19,17 @@ scope Bar:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Bar
|
||||
[RESULT] Computation successful!
|
||||
┌─[RESULT]─
|
||||
│ Computation successful!
|
||||
└─
|
||||
```
|
||||
|
@ -14,40 +14,48 @@ scope Foo:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[WARNING] These definitions have identical justifications and consequences;
|
||||
is it a mistake?
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
└─┐
|
||||
9 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
└─┐
|
||||
8 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ These definitions have identical justifications and consequences;
|
||||
│ is it a mistake?
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
│ │
|
||||
│ 9 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Foo
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
│ │
|
||||
│ 8 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Scopelang -s Foo
|
||||
[WARNING] These definitions have identical justifications and consequences;
|
||||
is it a mistake?
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
└─┐
|
||||
9 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
└─┐
|
||||
8 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ These definitions have identical justifications and consequences;
|
||||
│ is it a mistake?
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
│ │
|
||||
│ 9 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Foo
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
│ │
|
||||
│ 8 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
let scope Foo (x: integer|internal|output) =
|
||||
let x : integer = error_empty ⟨ ⟨true ⊢ ⟨1⟩⟩, ⟨true ⊢ ⟨1⟩⟩ | false ⊢ ∅ ⟩
|
||||
```
|
||||
@ -60,20 +68,22 @@ Dcalc translation below.
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc -s Foo
|
||||
[WARNING] These definitions have identical justifications and consequences;
|
||||
is it a mistake?
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
└─┐
|
||||
9 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
|
||||
┌─⯈ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
└─┐
|
||||
8 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ These definitions have identical justifications and consequences;
|
||||
│ is it a mistake?
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:9.3-9.15:
|
||||
│ │
|
||||
│ 9 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Foo
|
||||
│
|
||||
├─➤ tests/exception/good/double_definition.catala_en:8.3-8.15:
|
||||
│ │
|
||||
│ 8 │ definition x equals 1
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Foo
|
||||
let scope Foo (Foo_in: Foo_in): Foo {x: integer} =
|
||||
let set x : integer =
|
||||
error_empty ⟨ ⟨ ⟨true ⊢ ⟨1⟩⟩ | true ⊢ ⟨1⟩ ⟩ | false ⊢ ∅ ⟩
|
||||
|
@ -22,13 +22,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 0
|
||||
[RESULT] y = 0
|
||||
┌─[RESULT]─
|
||||
│ x = 0
|
||||
│ y = 0
|
||||
└─
|
||||
```
|
||||
|
@ -16,12 +16,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 1
|
||||
┌─[RESULT]─
|
||||
│ x = 1
|
||||
└─
|
||||
```
|
||||
|
@ -20,12 +20,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 2
|
||||
┌─[RESULT]─
|
||||
│ x = 2
|
||||
└─
|
||||
```
|
||||
|
@ -50,13 +50,18 @@ scope Benefit:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Benefit
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] benefit = $2,000.00
|
||||
[RESULT] person = Person { -- age: 26 -- disabled: true }
|
||||
┌─[RESULT]─
|
||||
│ benefit = $2,000.00
|
||||
│ person = Person { -- age: 26 -- disabled: true }
|
||||
└─
|
||||
```
|
||||
|
@ -44,14 +44,19 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope Test
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 2
|
||||
┌─[RESULT]─
|
||||
│ x = 2
|
||||
└─
|
||||
```
|
||||
|
||||
|
||||
@ -80,46 +85,54 @@ let scope Test (x: integer|internal|output) (f: Foo {x: integer}|internal) =
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Exceptions -s Foo -v x
|
||||
[RESULT]
|
||||
Printing the tree of exceptions for the definitions of variable "x" of scope "Foo".
|
||||
[RESULT]
|
||||
Definitions with label "base":
|
||||
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:9.3-9.26:
|
||||
└─┐
|
||||
9 │ label base definition x under condition
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─⯈ 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/exception/good/groups_of_exceptions.catala_en:17.3-17.49:
|
||||
└──┐
|
||||
17 │ label intermediate exception base definition x under condition
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─⯈ 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/exception/good/groups_of_exceptions.catala_en:25.3-25.38:
|
||||
└──┐
|
||||
25 │ exception intermediate definition x under condition
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─⯈ tests/exception/good/groups_of_exceptions.catala_en:29.3-29.38:
|
||||
└──┐
|
||||
29 │ exception intermediate definition x under condition
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
[RESULT]
|
||||
The exception tree structure is as follows:
|
||||
|
||||
"base"───"intermediate"───"exception_to_intermediate"
|
||||
┌─[RESULT]─
|
||||
│ Printing the tree of exceptions for the definitions of variable "x" of scope "Foo".
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Definitions with label "base":
|
||||
│
|
||||
├─➤ tests/exception/good/groups_of_exceptions.catala_en:9.3-9.26:
|
||||
│ │
|
||||
│ 9 │ label base definition x under condition
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
├─➤ 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/exception/good/groups_of_exceptions.catala_en:17.3-17.49:
|
||||
│ │
|
||||
│ 17 │ label intermediate exception base definition x under condition
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
├─➤ 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/exception/good/groups_of_exceptions.catala_en:25.3-25.38:
|
||||
│ │
|
||||
│ 25 │ exception intermediate definition x under condition
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
├─ Test
|
||||
│
|
||||
├─➤ tests/exception/good/groups_of_exceptions.catala_en:29.3-29.38:
|
||||
│ │
|
||||
│ 29 │ exception intermediate definition x under condition
|
||||
│ │ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
└─ Test
|
||||
┌─[RESULT]─
|
||||
│ The exception tree structure is as follows:
|
||||
│
|
||||
│ "base"───"intermediate"───"exception_to_intermediate"
|
||||
└─
|
||||
```
|
||||
|
@ -23,14 +23,19 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 0
|
||||
[RESULT] y = 1
|
||||
[RESULT] z = 0
|
||||
┌─[RESULT]─
|
||||
│ x = 0
|
||||
│ y = 1
|
||||
│ z = 0
|
||||
└─
|
||||
```
|
||||
|
@ -18,12 +18,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 1
|
||||
┌─[RESULT]─
|
||||
│ x = 1
|
||||
└─
|
||||
```
|
||||
|
@ -24,12 +24,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 0
|
||||
┌─[RESULT]─
|
||||
│ x = 0
|
||||
└─
|
||||
```
|
||||
|
@ -21,13 +21,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 1
|
||||
[RESULT] y = 3
|
||||
┌─[RESULT]─
|
||||
│ x = 1
|
||||
│ y = 3
|
||||
└─
|
||||
```
|
||||
|
@ -15,12 +15,17 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 1
|
||||
┌─[RESULT]─
|
||||
│ x = 1
|
||||
└─
|
||||
```
|
||||
|
@ -21,13 +21,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope A
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] x = 1
|
||||
[RESULT] y = 2
|
||||
┌─[RESULT]─
|
||||
│ x = 1
|
||||
│ y = 2
|
||||
└─
|
||||
```
|
||||
|
@ -23,25 +23,28 @@ scope R:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope R
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] r = 30
|
||||
┌─[RESULT]─
|
||||
│ r = 30
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope S
|
||||
[ERROR] During evaluation: conflict between multiple valid consequences for
|
||||
assigning the same variable.
|
||||
|
||||
┌─⯈ 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
|
||||
|
||||
┌─⯈ tests/func/bad/bad_func.catala_en:15.62-15.67:
|
||||
└──┐
|
||||
15 │ definition f of x under condition not b consequence equals x * x
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ During evaluation: conflict between multiple valid consequences for
|
||||
│ assigning the same variable.
|
||||
│
|
||||
├─➤ 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
|
||||
│
|
||||
├─➤ tests/func/bad/bad_func.catala_en:15.62-15.67:
|
||||
│ │
|
||||
│ 15 │ definition f of x under condition not b consequence equals x * x
|
||||
│ │ ‾‾‾‾‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -14,19 +14,22 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and
|
||||
definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency.catala_en:4.42-4.43:
|
||||
└─┐
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency.catala_en:10.20-10.21:
|
||||
└──┐
|
||||
10 │ definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Function argument name mismatch between declaration ('x') and definition
|
||||
│ ('y')
|
||||
│
|
||||
│ Argument declared here:
|
||||
├─➤ tests/func/bad/param_inconsistency.catala_en:4.42-4.43:
|
||||
│ │
|
||||
│ 4 │ internal f1 content decimal depends on x content integer
|
||||
│ │ ‾
|
||||
│
|
||||
│ Defined here:
|
||||
├─➤ tests/func/bad/param_inconsistency.catala_en:10.20-10.21:
|
||||
│ │
|
||||
│ 10 │ definition f1 of y under condition not cond
|
||||
│ │ ‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -13,19 +13,22 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and
|
||||
definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency2.catala_en:4.42-4.43:
|
||||
└─┐
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency2.catala_en:9.30-9.31:
|
||||
└─┐
|
||||
9 │ exception definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Function argument name mismatch between declaration ('x') and definition
|
||||
│ ('y')
|
||||
│
|
||||
│ Argument declared here:
|
||||
├─➤ tests/func/bad/param_inconsistency2.catala_en:4.42-4.43:
|
||||
│ │
|
||||
│ 4 │ internal f1 content decimal depends on x content integer
|
||||
│ │ ‾
|
||||
│
|
||||
│ Defined here:
|
||||
├─➤ tests/func/bad/param_inconsistency2.catala_en:9.30-9.31:
|
||||
│ │
|
||||
│ 9 │ exception definition f1 of y under condition not cond
|
||||
│ │ ‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -13,19 +13,22 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and
|
||||
definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency3.catala_en:4.42-4.43:
|
||||
└─┐
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/func/bad/param_inconsistency3.catala_en:9.30-9.31:
|
||||
└─┐
|
||||
9 │ exception definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ Function argument name mismatch between declaration ('x') and definition
|
||||
│ ('y')
|
||||
│
|
||||
│ Argument declared here:
|
||||
├─➤ tests/func/bad/param_inconsistency3.catala_en:4.42-4.43:
|
||||
│ │
|
||||
│ 4 │ internal f1 content decimal depends on x content integer
|
||||
│ │ ‾
|
||||
│
|
||||
│ Defined here:
|
||||
├─➤ tests/func/bad/param_inconsistency3.catala_en:9.30-9.31:
|
||||
│ │
|
||||
│ 9 │ exception definition f1 of y under condition not cond
|
||||
│ │ ‾
|
||||
└─
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -10,13 +10,15 @@ scope RecursiveFunc:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope RecursiveFunc
|
||||
[ERROR] The variable f is used in one of its definitions
|
||||
(Catala doesn't support recursion)
|
||||
|
||||
┌─⯈ tests/func/bad/recursive.catala_en:8.28-8.29:
|
||||
└─┐
|
||||
8 │ definition f of x equals f of x + 1
|
||||
│ ‾
|
||||
└─ Article
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ The variable f is used in one of its definitions
|
||||
│ (Catala doesn't support recursion)
|
||||
│
|
||||
├─➤ tests/func/bad/recursive.catala_en:8.28-8.29:
|
||||
│ │
|
||||
│ 8 │ definition f of x equals f of x + 1
|
||||
│ │ ‾
|
||||
└─ Article
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -15,8 +15,12 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
|
@ -15,8 +15,12 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
|
@ -13,8 +13,12 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
|
@ -21,8 +21,12 @@ scope T:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
@ -42,6 +46,7 @@ let scope T (T_in: T_in): T {y: integer} =
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret --lcalc -s T --avoid-exceptions -O --closure-conversion
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] y = -2
|
||||
┌─[RESULT]─
|
||||
│ y = -2
|
||||
└─
|
||||
```
|
||||
|
@ -19,28 +19,36 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[WARNING] Unused varible: a does not contribute to computing any of scope B
|
||||
outputs. Did you forget something?
|
||||
|
||||
┌─⯈ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
└─┐
|
||||
9 │ a scope A
|
||||
│ ‾
|
||||
└─ Test
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ Unused varible: a does not contribute to computing any of scope B outputs.
|
||||
│ Did you forget something?
|
||||
│
|
||||
├─➤ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
│ │
|
||||
│ 9 │ a scope A
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Scopelang -s B
|
||||
[WARNING] Unused varible: a does not contribute to computing any of scope B
|
||||
outputs. Did you forget something?
|
||||
|
||||
┌─⯈ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
└─┐
|
||||
9 │ a scope A
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ Unused varible: a does not contribute to computing any of scope B outputs.
|
||||
│ Did you forget something?
|
||||
│
|
||||
├─➤ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
│ │
|
||||
│ 9 │ a scope A
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
let scope B (b: bool|input) (a: A {f: integer → integer}|internal) =
|
||||
let a : A {f: integer → integer} =
|
||||
A of {"f"= (λ (x: integer) → ⟨ ⟨b && x > 0 ⊢ ⟨x - 1⟩⟩ | false ⊢ ∅ ⟩)}
|
||||
@ -48,14 +56,16 @@ let scope B (b: bool|input) (a: A {f: integer → integer}|internal) =
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc -s A
|
||||
[WARNING] Unused varible: a does not contribute to computing any of scope B
|
||||
outputs. Did you forget something?
|
||||
|
||||
┌─⯈ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
└─┐
|
||||
9 │ a scope A
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ Unused varible: a does not contribute to computing any of scope B outputs.
|
||||
│ Did you forget something?
|
||||
│
|
||||
├─➤ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
│ │
|
||||
│ 9 │ a scope A
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
let scope A
|
||||
(A_in: A_in {f_in: integer → ⟨integer⟩})
|
||||
: A {f: integer → integer}
|
||||
@ -71,14 +81,16 @@ let scope A
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc -s B
|
||||
[WARNING] Unused varible: a does not contribute to computing any of scope B
|
||||
outputs. Did you forget something?
|
||||
|
||||
┌─⯈ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
└─┐
|
||||
9 │ a scope A
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[WARNING]─
|
||||
│
|
||||
│ Unused varible: a does not contribute to computing any of scope B outputs.
|
||||
│ Did you forget something?
|
||||
│
|
||||
├─➤ tests/func/good/context_func.catala_en:9.3-9.4:
|
||||
│ │
|
||||
│ 9 │ a scope A
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
let scope B (B_in: B_in {b_in: bool}): B =
|
||||
let get b : bool = B_in.b_in in
|
||||
let set a : A {f: integer → integer} =
|
||||
|
@ -25,12 +25,17 @@ scope R:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope R
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] r = 30
|
||||
┌─[RESULT]─
|
||||
│ r = 30
|
||||
└─
|
||||
```
|
||||
|
@ -16,13 +16,19 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala
|
||||
@ -41,9 +47,10 @@ scope T1:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope T1
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] o1 = 20.0
|
||||
[RESULT] o2 = 5.0
|
||||
┌─[RESULT]─
|
||||
│ o1 = 20.0
|
||||
│ o2 = 5.0
|
||||
└─
|
||||
```
|
||||
|
||||
## Multi-argument function
|
||||
@ -67,6 +74,7 @@ scope T2:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala test-scope T2
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] o = 40.0
|
||||
┌─[RESULT]─
|
||||
│ o = 40.0
|
||||
└─
|
||||
```
|
||||
|
@ -44,8 +44,12 @@ two closures in Foo.r are different even with optimizations enabled.
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck --check-invariants
|
||||
[RESULT] All invariant checks passed
|
||||
[RESULT] Typechecking successful!
|
||||
┌─[RESULT]─
|
||||
│ All invariant checks passed
|
||||
└─
|
||||
┌─[RESULT]─
|
||||
│ Typechecking successful!
|
||||
└─
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
@ -159,6 +163,7 @@ let scope Foo
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret --lcalc -s Foo --avoid-exceptions -O --closure-conversion
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] z = 11
|
||||
┌─[RESULT]─
|
||||
│ z = 11
|
||||
└─
|
||||
```
|
||||
|
@ -16,21 +16,22 @@ scope B:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] This subscope variable is a mandatory input but no definition was
|
||||
provided.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/io/bad/forgot_input.catala_en:9.3-9.4:
|
||||
└─┐
|
||||
9 │ a scope A
|
||||
│ ‾
|
||||
└─ Test
|
||||
|
||||
Incriminated variable:
|
||||
┌─⯈ tests/io/bad/forgot_input.catala_en:6.9-6.10:
|
||||
└─┐
|
||||
6 │ input x content integer
|
||||
│ ‾
|
||||
└─ Test
|
||||
┌─[ERROR]─
|
||||
│
|
||||
│ This subscope variable is a mandatory input but no definition was provided.
|
||||
│
|
||||
│ Incriminated subscope:
|
||||
├─➤ tests/io/bad/forgot_input.catala_en:9.3-9.4:
|
||||
│ │
|
||||
│ 9 │ a scope A
|
||||
│ │ ‾
|
||||
├─ Test
|
||||
│
|
||||
│ Incriminated variable:
|
||||
├─➤ tests/io/bad/forgot_input.catala_en:6.9-6.10:
|
||||
│ │
|
||||
│ 6 │ input x content integer
|
||||
│ │ ‾
|
||||
└─ Test
|
||||
#return code 123#
|
||||
```
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user