mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-19 00:15:39 +03:00
Clearer errors (#481)
This commit is contained in:
commit
f0f8c088ce
@ -32,6 +32,10 @@ authors:
|
||||
affiliation: "INRIA, ENS Lyon"
|
||||
- given-names: Lilya
|
||||
family-names: Slimani
|
||||
- given-name: Justine
|
||||
family-names: Banuls
|
||||
- given-name: Aminata
|
||||
family-names: Boiguillé
|
||||
repository-code: "https://github.com/CatalaLang/catala"
|
||||
url: "https://catala-lang.org/"
|
||||
abstract: >-
|
||||
|
@ -957,7 +957,7 @@ let driver
|
||||
| _ -> Message.raise_error "The command \"%s\" is unknown to clerk." command
|
||||
with Message.CompilerError content ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content content Error;
|
||||
Message.Content.emit content Error;
|
||||
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
|
||||
return_err
|
||||
|
||||
|
@ -41,4 +41,4 @@ Related modules:
|
||||
|
||||
Related modules:
|
||||
|
||||
{!modules: Catala_utils.File Catala_utils.Mark Catala_utils.Cli Catala_utils.String}
|
||||
{!modules: Catala_utils.File Catala_utils.Mark Catala_utils.Cli Catala_utils.String Catala_utils.Suggestions}
|
@ -116,85 +116,107 @@ let pp_marker target ppf =
|
||||
module Content = struct
|
||||
type message = Format.formatter -> unit
|
||||
type position = { pos_message : message option; pos : Pos.t }
|
||||
type t = { message : message; positions : position list }
|
||||
|
||||
let of_message (message : message) : t = { message; positions = [] }
|
||||
type message_element =
|
||||
| MainMessage of message
|
||||
| Position of position
|
||||
| Suggestion of string list
|
||||
| Result of message
|
||||
|
||||
type t = message_element list
|
||||
|
||||
let of_message (message : message) : t = [MainMessage message]
|
||||
let of_result (message : message) : t = [Result message]
|
||||
let prepend_message (content : t) prefix : t = MainMessage prefix :: content
|
||||
|
||||
let to_internal_error (content : t) : t =
|
||||
let internal_error_prefix ppf =
|
||||
Format.pp_print_string ppf
|
||||
"Internal Error, please report to \
|
||||
https://github.com/CatalaLang/catala/issues."
|
||||
in
|
||||
prepend_message content internal_error_prefix
|
||||
|
||||
let add_suggestion (content : t) (suggestion : string list) =
|
||||
content @ [Suggestion suggestion]
|
||||
|
||||
let of_string (s : string) : t =
|
||||
{ message = (fun ppf -> Format.pp_print_string ppf s); positions = [] }
|
||||
[MainMessage (fun ppf -> Format.pp_print_string ppf s)]
|
||||
|
||||
let internal_error_prefix =
|
||||
"Internal Error, please report to \
|
||||
https://github.com/CatalaLang/catala/issues : "
|
||||
|
||||
let prepend_message (content : t) prefix : t =
|
||||
{
|
||||
content with
|
||||
message = (fun ppf -> Format.fprintf ppf "%t@,%t" prefix content.message);
|
||||
}
|
||||
|
||||
let mark_as_internal_error (content : t) : t =
|
||||
{
|
||||
content with
|
||||
message =
|
||||
(fun ppf ->
|
||||
Format.fprintf ppf "%s@,%t" internal_error_prefix content.message);
|
||||
}
|
||||
let emit (content : t) (target : content_type) : unit =
|
||||
match Cli.globals.message_format with
|
||||
| Cli.Human ->
|
||||
let ppf = get_ppf target in
|
||||
Format.fprintf ppf "@[<hv>%t%t%a@]@." (pp_marker target)
|
||||
(fun (ppf : Format.formatter) ->
|
||||
match content, target with
|
||||
| MainMessage _ :: _, (Result | Error) -> Format.pp_print_space ppf ()
|
||||
| _ -> Format.pp_print_char ppf ' ')
|
||||
(fun (ppf : Format.formatter) (message_elements : t) ->
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf "@,@,")
|
||||
(fun ppf (elt : message_element) ->
|
||||
match elt with
|
||||
| Position pos ->
|
||||
Option.iter
|
||||
(fun msg -> Format.fprintf ppf "%t@," msg)
|
||||
pos.pos_message;
|
||||
Pos.format_loc_text ppf pos.pos
|
||||
| MainMessage msg -> msg ppf
|
||||
| Result msg -> msg ppf
|
||||
| Suggestion suggestions_list ->
|
||||
Suggestions.format ppf suggestions_list)
|
||||
ppf message_elements)
|
||||
content
|
||||
| Cli.GNU ->
|
||||
(* The top message doesn't come with a position, which is not something
|
||||
the GNU standard allows. So we look the position list and put the top
|
||||
message everywhere there is not a more precise message. If we can't
|
||||
find a position without a more precise message, we just take the first
|
||||
position in the list to pair with the message. *)
|
||||
let ppf = get_ppf target in
|
||||
Format.pp_print_list ~pp_sep:Format.pp_print_newline
|
||||
(fun ppf elt ->
|
||||
let pos, message =
|
||||
match elt with
|
||||
| MainMessage m ->
|
||||
let pos =
|
||||
List.find_map
|
||||
(function
|
||||
| Position { pos_message = None; pos } -> Some pos
|
||||
| _ -> None)
|
||||
content
|
||||
|> function
|
||||
| None ->
|
||||
List.find_map
|
||||
(function
|
||||
| Position { pos_message = _; pos } -> Some pos
|
||||
| _ -> None)
|
||||
content
|
||||
| some -> some
|
||||
in
|
||||
pos, m
|
||||
| Position { pos_message; pos } ->
|
||||
let message =
|
||||
match pos_message with Some m -> m | None -> fun _ -> ()
|
||||
in
|
||||
Some pos, message
|
||||
| Result m -> None, m
|
||||
| Suggestion sl -> None, fun ppf -> Suggestions.format ppf sl
|
||||
in
|
||||
Option.iter
|
||||
(fun pos ->
|
||||
Format.fprintf ppf "@{<blue>%s@}: " (Pos.to_string_short pos))
|
||||
pos;
|
||||
pp_marker target ppf;
|
||||
Format.pp_print_char ppf ' ';
|
||||
Format.pp_print_string ppf (unformat message))
|
||||
ppf content;
|
||||
Format.pp_print_newline ppf ()
|
||||
end
|
||||
|
||||
open Content
|
||||
|
||||
let emit_content (content : Content.t) (target : content_type) : unit =
|
||||
let { message; positions } = content in
|
||||
match Cli.globals.message_format with
|
||||
| Cli.Human ->
|
||||
let ppf = get_ppf target in
|
||||
Format.fprintf ppf "@[<v>@[<hov 0>%t%t%t@]%a@]@." (pp_marker target)
|
||||
(fun ppf ->
|
||||
match target with
|
||||
| Log | Error | Warning | Debug -> Format.pp_print_char ppf ' '
|
||||
| Result -> Format.pp_print_space ppf ())
|
||||
message
|
||||
(fun ppf l ->
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun _ () -> ())
|
||||
(fun ppf pos ->
|
||||
Format.pp_print_cut ppf ();
|
||||
Format.pp_print_cut ppf ();
|
||||
Option.iter
|
||||
(fun msg -> Format.fprintf ppf "%t@," msg)
|
||||
pos.pos_message;
|
||||
Pos.format_loc_text ppf pos.pos)
|
||||
ppf l)
|
||||
positions
|
||||
| Cli.GNU ->
|
||||
(* The top message doesn't come with a position, which is not something the
|
||||
GNU standard allows. So we look the position list and put the top message
|
||||
everywhere there is not a more precise message. If we can'r find a
|
||||
position without a more precise message, we just take the first position
|
||||
in the list to pair with the message. *)
|
||||
let ppf = get_ppf target in
|
||||
let () =
|
||||
if
|
||||
positions != []
|
||||
&& List.for_all
|
||||
(fun (pos' : Content.position) -> Option.is_some pos'.pos_message)
|
||||
positions
|
||||
then
|
||||
Format.fprintf ppf "@{<blue>%s@}: %t %s@\n"
|
||||
(Pos.to_string_short (List.hd positions).pos)
|
||||
(pp_marker target) (unformat message)
|
||||
in
|
||||
Format.pp_print_list ~pp_sep:Format.pp_print_newline
|
||||
(fun ppf pos' ->
|
||||
Format.fprintf ppf "@{<blue>%s@}: %t %s"
|
||||
(Pos.to_string_short pos'.pos)
|
||||
(pp_marker target)
|
||||
(match pos'.pos_message with
|
||||
| None -> unformat message
|
||||
| Some msg' -> unformat msg'))
|
||||
ppf positions
|
||||
|
||||
(** {1 Error exception} *)
|
||||
|
||||
exception CompilerError of Content.t
|
||||
@ -203,31 +225,37 @@ exception CompilerError of Content.t
|
||||
|
||||
let raise_spanned_error
|
||||
?(span_msg : Content.message option)
|
||||
?(suggestion = ([] : string list))
|
||||
(span : Pos.t)
|
||||
format =
|
||||
Format.kdprintf
|
||||
(fun message ->
|
||||
raise
|
||||
(CompilerError
|
||||
{ message; positions = [{ pos_message = span_msg; pos = span }] }))
|
||||
format
|
||||
let continuation (message : Format.formatter -> unit) =
|
||||
raise
|
||||
(CompilerError
|
||||
([MainMessage message; Position { pos_message = span_msg; pos = span }]
|
||||
@ match suggestion with [] -> [] | sugg -> [Suggestion sugg]))
|
||||
in
|
||||
Format.kdprintf continuation format
|
||||
|
||||
let raise_multispanned_error_full
|
||||
?(suggestion = ([] : string list))
|
||||
(spans : (Content.message option * Pos.t) list)
|
||||
format =
|
||||
Format.kdprintf
|
||||
(fun message ->
|
||||
raise
|
||||
(CompilerError
|
||||
{
|
||||
message;
|
||||
positions =
|
||||
List.map (fun (pos_message, pos) -> { pos_message; pos }) spans;
|
||||
}))
|
||||
(MainMessage message
|
||||
:: List.map
|
||||
(fun (pos_message, pos) -> Position { pos_message; pos })
|
||||
spans
|
||||
@ match suggestion with [] -> [] | sugg -> [Suggestion sugg])))
|
||||
format
|
||||
|
||||
let raise_multispanned_error spans format =
|
||||
raise_multispanned_error_full
|
||||
let raise_multispanned_error
|
||||
?(suggestion = ([] : string list))
|
||||
(spans : (string option * Pos.t) list)
|
||||
format =
|
||||
raise_multispanned_error_full ~suggestion
|
||||
(List.map
|
||||
(fun (msg, pos) ->
|
||||
Option.map (fun s ppf -> Format.pp_print_string ppf s) msg, pos)
|
||||
@ -236,11 +264,14 @@ let raise_multispanned_error spans format =
|
||||
|
||||
let raise_error format =
|
||||
Format.kdprintf
|
||||
(fun message -> raise (CompilerError { message; positions = [] }))
|
||||
(fun message -> raise (CompilerError [MainMessage message]))
|
||||
format
|
||||
|
||||
let raise_internal_error format =
|
||||
raise_error ("%s" ^^ format) internal_error_prefix
|
||||
Format.kdprintf
|
||||
(fun message ->
|
||||
raise (CompilerError (Content.to_internal_error [MainMessage message])))
|
||||
format
|
||||
|
||||
(** {1 Warning printing}*)
|
||||
|
||||
@ -253,12 +284,11 @@ let emit_multispanned_warning
|
||||
format =
|
||||
Format.kdprintf
|
||||
(fun message ->
|
||||
emit_content
|
||||
{
|
||||
message;
|
||||
positions =
|
||||
List.map (fun (pos_message, pos) -> { pos_message; pos }) pos;
|
||||
}
|
||||
Content.emit
|
||||
(MainMessage message
|
||||
:: List.map
|
||||
(fun (pos_message, pos) -> Position { pos_message; pos })
|
||||
pos)
|
||||
Warning)
|
||||
format
|
||||
|
||||
@ -271,16 +301,14 @@ let emit_spanned_warning
|
||||
let emit_warning format = emit_multispanned_warning [] format
|
||||
|
||||
let emit_log format =
|
||||
Format.kdprintf
|
||||
(fun message -> emit_content { message; positions = [] } Log)
|
||||
format
|
||||
Format.kdprintf (fun message -> Content.emit [MainMessage message] Log) format
|
||||
|
||||
let emit_debug format =
|
||||
Format.kdprintf
|
||||
(fun message -> emit_content { message; positions = [] } Debug)
|
||||
(fun message -> Content.emit [MainMessage message] Debug)
|
||||
format
|
||||
|
||||
let emit_result format =
|
||||
Format.kdprintf
|
||||
(fun message -> emit_content { message; positions = [] } Result)
|
||||
(fun message -> Content.emit [MainMessage message] Result)
|
||||
format
|
||||
|
@ -27,19 +27,35 @@
|
||||
|
||||
(** {1 Message content} *)
|
||||
|
||||
type content_type = Error | Warning | Debug | Log | Result
|
||||
|
||||
module Content : sig
|
||||
(** {2 Types}*)
|
||||
|
||||
type message = Format.formatter -> unit
|
||||
type t
|
||||
|
||||
val of_message : (Format.formatter -> unit) -> t
|
||||
(** {2 Content creation}*)
|
||||
|
||||
val of_message : message -> t
|
||||
|
||||
val of_result : message -> t
|
||||
(** Similar as [of_message] but tailored for when you want to print the result
|
||||
of a value, etc. *)
|
||||
|
||||
val of_string : string -> t
|
||||
val mark_as_internal_error : t -> t
|
||||
val prepend_message : t -> (Format.formatter -> unit) -> t
|
||||
|
||||
(** {2 Content manipulation}*)
|
||||
|
||||
val to_internal_error : t -> t
|
||||
val add_suggestion : t -> string list -> t
|
||||
|
||||
(** {2 Content emission}*)
|
||||
|
||||
val emit : t -> content_type -> unit
|
||||
end
|
||||
|
||||
type content_type = Error | Warning | Debug | Log | Result
|
||||
|
||||
val emit_content : Content.t -> content_type -> unit
|
||||
(** This functions emits the message according to the emission type defined by
|
||||
[Cli.message_format_flag]. *)
|
||||
|
||||
@ -51,17 +67,22 @@ exception CompilerError of Content.t
|
||||
|
||||
val raise_spanned_error :
|
||||
?span_msg:Content.message ->
|
||||
?suggestion:string list ->
|
||||
Pos.t ->
|
||||
('a, Format.formatter, unit, 'b) format4 ->
|
||||
'a
|
||||
|
||||
val raise_multispanned_error_full :
|
||||
?suggestion:string list ->
|
||||
(Content.message option * Pos.t) list ->
|
||||
('a, Format.formatter, unit, 'b) format4 ->
|
||||
'a
|
||||
|
||||
val raise_multispanned_error :
|
||||
(string option * Pos.t) list -> ('a, Format.formatter, unit, 'b) format4 -> 'a
|
||||
?suggestion:string list ->
|
||||
(string option * Pos.t) list ->
|
||||
('a, Format.formatter, unit, 'b) format4 ->
|
||||
'a
|
||||
|
||||
val raise_error : ('a, Format.formatter, unit, 'b) format4 -> 'a
|
||||
val raise_internal_error : ('a, Format.formatter, unit, 'b) format4 -> 'a
|
||||
|
@ -200,15 +200,17 @@ let format_loc_text ppf (pos : t) =
|
||||
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 ();
|
||||
(* Format.pp_print_cut ppf (); *)
|
||||
let rec pp_legal nspaces = function
|
||||
| [last] -> Format.fprintf ppf "@{<bold;blue>%*s└─ %s@}" nspaces "" last
|
||||
| [last] ->
|
||||
Format.fprintf ppf "@,@{<bold;blue>%*s└─ %s@}" nspaces "" last
|
||||
| l :: lines ->
|
||||
Format.fprintf ppf "@{<bold;blue>%*s└┬ %s@}@," nspaces "" l;
|
||||
Format.fprintf ppf "@,@{<bold;blue>%*s└┬ %s@}" nspaces "" l;
|
||||
pp_legal (nspaces + 1) lines
|
||||
| [] -> ()
|
||||
in
|
||||
pp_legal (nspaces + 1) legal_pos_lines
|
||||
pp_legal (nspaces + 1) legal_pos_lines;
|
||||
Format.pp_close_box ppf ()
|
||||
with Sys_error _ -> Format.fprintf ppf "Location: %s" (to_string pos)
|
||||
|
||||
let no_pos : t =
|
||||
|
105
compiler/catala_utils/suggestions.ml
Normal file
105
compiler/catala_utils/suggestions.ml
Normal file
@ -0,0 +1,105 @@
|
||||
(* This file is part of the Catala compiler, a specification language for tax
|
||||
and social benefits computation rules. Copyright (C) 2023 Inria, contributor:
|
||||
Aminata Boiguillé <aminata.boiguille@etu.sorbonne-universite.fr>, Emile
|
||||
Rolley <emile.rolley@tuta.io>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
use this file except in compliance with the License. You may obtain a copy of
|
||||
the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations under
|
||||
the License. *)
|
||||
|
||||
(** Computes the levenshtein distance between two strings, used to provide error
|
||||
messages suggestions *)
|
||||
let levenshtein_distance (s : string) (t : string) : int =
|
||||
let three_way_minimum a b c = min a (min b c) in
|
||||
let m = String.length s and n = String.length t in
|
||||
(* for all i and j, d.(i).(j) will hold the Levenshtein distance between the
|
||||
first i characters of s and the first j characters of t *)
|
||||
let d = Array.make_matrix (m + 1) (n + 1) 0 in
|
||||
|
||||
for i = 0 to m do
|
||||
d.(i).(0) <- i
|
||||
(* the distance of any first string to an empty second string *)
|
||||
done;
|
||||
for j = 0 to n do
|
||||
d.(0).(j) <- j
|
||||
(* the distance of any second string to an empty first string *)
|
||||
done;
|
||||
|
||||
for j = 1 to n do
|
||||
for i = 1 to m do
|
||||
if s.[i - 1] = t.[j - 1] then d.(i).(j) <- d.(i - 1).(j - 1)
|
||||
(* no operation required *)
|
||||
else
|
||||
d.(i).(j) <-
|
||||
three_way_minimum
|
||||
(d.(i - 1).(j) + 1) (* a deletion *)
|
||||
(d.(i).(j - 1) + 1) (* an insertion *)
|
||||
(d.(i - 1).(j - 1) + 1) (* a substitution *)
|
||||
done
|
||||
done;
|
||||
|
||||
d.(m).(n)
|
||||
|
||||
(*We create a list composed by strings that satisfy the following rule : they
|
||||
have the same levenshtein distance, which is the minimum distance between the
|
||||
reference word "keyword" and all the strings in "candidates" (with the
|
||||
condition that this minimum is equal to or less than one third of the length
|
||||
of keyword + 1, in order to get suggestions close to "keyword")*)
|
||||
let suggestion_minimum_levenshtein_distance_association
|
||||
(candidates : string list)
|
||||
(keyword : string) : string list =
|
||||
let rec strings_minimum_levenshtein_distance
|
||||
(minimum : int)
|
||||
(result : string list)
|
||||
(candidates' : string list) : string list =
|
||||
(*As we iterate through the "candidates'" list, we create a list "result"
|
||||
with all strings that have the last minimum levenshtein distance found
|
||||
("minimum").*)
|
||||
match candidates' with
|
||||
(*When a new minimum levenshtein distance is found, the new result list is
|
||||
our new element "current_string" followed by strings that have the same
|
||||
minimum distance. It will be the "result" list if there is no levenshtein
|
||||
distance smaller than this new minimum.*)
|
||||
| current_string :: tail ->
|
||||
let current_levenshtein_distance =
|
||||
levenshtein_distance current_string keyword
|
||||
in
|
||||
if current_levenshtein_distance < minimum then
|
||||
strings_minimum_levenshtein_distance current_levenshtein_distance
|
||||
[current_string] tail
|
||||
(*The "result" list is updated (we append "current_string" to "result")
|
||||
when a new string shares the same minimum levenshtein distance
|
||||
"minimum"*)
|
||||
else if current_levenshtein_distance = minimum then
|
||||
strings_minimum_levenshtein_distance minimum
|
||||
(result @ [current_string])
|
||||
tail
|
||||
(*If a levenshtein distance greater than the minimum is found, "result"
|
||||
doesn't change*)
|
||||
else strings_minimum_levenshtein_distance minimum result tail
|
||||
(*The "result" list is returned at the end of the "candidates'" list.*)
|
||||
| [] -> result
|
||||
in
|
||||
strings_minimum_levenshtein_distance
|
||||
(1 + (String.length keyword / 3))
|
||||
(*In order to select suggestions that are not too far away from the
|
||||
keyword*)
|
||||
[] candidates
|
||||
|
||||
let format (ppf : Format.formatter) (suggestions_list : string list) =
|
||||
match suggestions_list with
|
||||
| [] -> ()
|
||||
| _ :: _ ->
|
||||
Format.pp_print_string ppf "Maybe you wanted to write : ";
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ or ")
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string)
|
||||
ppf suggestions_list
|
23
compiler/catala_utils/suggestions.mli
Normal file
23
compiler/catala_utils/suggestions.mli
Normal file
@ -0,0 +1,23 @@
|
||||
(* This file is part of the Catala compiler, a specification language for tax
|
||||
and social benefits computation rules. Copyright (C) 2023 Inria, contributor:
|
||||
Aminata Boiguillé <aminata.boiguille@etu.sorbonne-universite.fr>, Emile
|
||||
Rolley <emile.rolley@tuta.io>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
use this file except in compliance with the License. You may obtain a copy of
|
||||
the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing permissions and limitations under
|
||||
the License. *)
|
||||
|
||||
val suggestion_minimum_levenshtein_distance_association :
|
||||
string list -> string -> string list
|
||||
(**Returns a list of the closest words into {!name:candidates} to the keyword
|
||||
{!name:keyword}*)
|
||||
|
||||
val format : Format.formatter -> string list -> unit
|
@ -120,6 +120,20 @@ let translate_unop (op : Surface.Ast.unop) pos : Ast.expr boxed =
|
||||
"This operator doesn't exist, dates can't be negative"
|
||||
| S.KDuration -> TLit TDuration)
|
||||
|
||||
let raise_error_cons_not_found
|
||||
(ctxt : Name_resolution.context)
|
||||
(constructor : string Mark.pos) =
|
||||
let constructors = Ident.Map.keys ctxt.constructor_idmap in
|
||||
let closest_constructors =
|
||||
Suggestions.suggestion_minimum_levenshtein_distance_association constructors
|
||||
(Mark.remove constructor)
|
||||
in
|
||||
Message.raise_spanned_error
|
||||
~span_msg:(fun ppf -> Format.fprintf ppf "Here is your code :")
|
||||
~suggestion:closest_constructors (Mark.get constructor)
|
||||
"The name of this constructor has not been defined before@ (it's probably \
|
||||
a typographical error)."
|
||||
|
||||
let disambiguate_constructor
|
||||
(ctxt : Name_resolution.context)
|
||||
(constructor : (S.path * S.uident Mark.pos) Mark.pos list)
|
||||
@ -133,10 +147,7 @@ let disambiguate_constructor
|
||||
in
|
||||
let possible_c_uids =
|
||||
try Ident.Map.find (Mark.remove constructor) ctxt.constructor_idmap
|
||||
with Not_found ->
|
||||
Message.raise_spanned_error (Mark.get constructor)
|
||||
"The name of this constructor has not been defined before, maybe it is \
|
||||
a typo?"
|
||||
with Not_found -> raise_error_cons_not_found ctxt constructor
|
||||
in
|
||||
match path with
|
||||
| [] ->
|
||||
@ -493,9 +504,7 @@ let rec translate_expr
|
||||
let possible_c_uids =
|
||||
try Ident.Map.find constructor ctxt.constructor_idmap
|
||||
with Not_found ->
|
||||
Message.raise_spanned_error pos_constructor
|
||||
"The name of this constructor has not been defined before, maybe it \
|
||||
is a typo?"
|
||||
raise_error_cons_not_found ctxt (constructor, pos_constructor)
|
||||
in
|
||||
let mark_constructor = Untyped { pos = pos_constructor } in
|
||||
|
||||
|
@ -124,7 +124,7 @@ module Passes = struct
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Printexc.raise_with_backtrace
|
||||
(Message.CompilerError
|
||||
(Message.Content.mark_as_internal_error error_content))
|
||||
(Message.Content.to_internal_error error_content))
|
||||
bt
|
||||
in
|
||||
if check_invariants then (
|
||||
@ -883,19 +883,19 @@ let main () =
|
||||
| exception Cli.Exit_with n -> exit n
|
||||
| exception Message.CompilerError content ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content content Error;
|
||||
Message.Content.emit content Error;
|
||||
if Cli.globals.debug then Printexc.print_raw_backtrace stderr bt;
|
||||
exit Cmd.Exit.some_error
|
||||
| exception Sys_error msg ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content
|
||||
Message.Content.emit
|
||||
(Message.Content.of_string ("System error: " ^ msg))
|
||||
Error;
|
||||
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
|
||||
exit Cmd.Exit.internal_error
|
||||
| exception e ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content
|
||||
Message.Content.emit
|
||||
(Message.Content.of_string ("Unexpected error: " ^ Printexc.to_string e))
|
||||
Error;
|
||||
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
|
||||
|
@ -590,7 +590,7 @@ source_file: BEGIN_CODE SCOPE UIDENT COLON RULE LIDENT YEAR
|
||||
## LIDENT
|
||||
##
|
||||
|
||||
expected a condition or a consequence for this rule, or the rest of the variable qualified name
|
||||
expected 'under condition' followed by a condition, 'equals' followed by the definition body, or the rest of the variable qualified name
|
||||
|
||||
source_file: BEGIN_CODE SCOPE UIDENT COLON RULE YEAR
|
||||
##
|
||||
|
@ -21,43 +21,6 @@
|
||||
open Sedlexing
|
||||
open Catala_utils
|
||||
|
||||
(** {1 Internal functions} *)
|
||||
|
||||
(** Three-way minimum *)
|
||||
let minimum a b c = min a (min b c)
|
||||
|
||||
(** Computes the levenshtein distance between two strings, used to provide error
|
||||
messages suggestions *)
|
||||
let levenshtein_distance (s : string) (t : string) : int =
|
||||
let m = String.length s and n = String.length t in
|
||||
(* for all i and j, d.(i).(j) will hold the Levenshtein distance between the
|
||||
first i characters of s and the first j characters of t *)
|
||||
let d = Array.make_matrix (m + 1) (n + 1) 0 in
|
||||
|
||||
for i = 0 to m do
|
||||
d.(i).(0) <- i
|
||||
(* the distance of any first string to an empty second string *)
|
||||
done;
|
||||
for j = 0 to n do
|
||||
d.(0).(j) <- j
|
||||
(* the distance of any second string to an empty first string *)
|
||||
done;
|
||||
|
||||
for j = 1 to n do
|
||||
for i = 1 to m do
|
||||
if s.[i - 1] = t.[j - 1] then d.(i).(j) <- d.(i - 1).(j - 1)
|
||||
(* no operation required *)
|
||||
else
|
||||
d.(i).(j) <-
|
||||
minimum
|
||||
(d.(i - 1).(j) + 1) (* a deletion *)
|
||||
(d.(i).(j - 1) + 1) (* an insertion *)
|
||||
(d.(i - 1).(j - 1) + 1) (* a substitution *)
|
||||
done
|
||||
done;
|
||||
|
||||
d.(m).(n)
|
||||
|
||||
(** After parsing, heading structure is completely flat because of the
|
||||
[source_file_item] rule. We need to tree-i-fy the flat structure, by looking
|
||||
at the precedence of the law headings. *)
|
||||
@ -97,9 +60,6 @@ let rec law_struct_list_to_tree (f : Ast.law_structure list) :
|
||||
let gobbled, rest_out = split_rest_tree rest_tree in
|
||||
LawHeading (heading, gobbled) :: rest_out))
|
||||
|
||||
(** Style with which to display syntax hints in the terminal output *)
|
||||
let pp_hint ppf s = Format.fprintf ppf "@{<yellow>\"%s\"@}" s
|
||||
|
||||
(** Usage: [raise_parser_error error_loc last_good_loc token msg]
|
||||
|
||||
Raises an error message featuring the [error_loc] position where the parser
|
||||
@ -107,11 +67,12 @@ let pp_hint ppf s = Format.fprintf ppf "@{<yellow>\"%s\"@}" s
|
||||
message [msg]. If available, displays [last_good_loc] the location of the
|
||||
last token correctly parsed. *)
|
||||
let raise_parser_error
|
||||
?(suggestion : string list option)
|
||||
(error_loc : Pos.t)
|
||||
(last_good_loc : Pos.t option)
|
||||
(token : string)
|
||||
(msg : Format.formatter -> unit) : 'a =
|
||||
Message.raise_multispanned_error_full
|
||||
Message.raise_multispanned_error_full ?suggestion
|
||||
((Some (fun ppf -> Format.pp_print_string ppf "Error token:"), error_loc)
|
||||
::
|
||||
(match last_good_loc with
|
||||
@ -121,7 +82,9 @@ let raise_parser_error
|
||||
( Some (fun ppf -> Format.pp_print_string ppf "Last good token:"),
|
||||
last_good_loc );
|
||||
]))
|
||||
"@[<v>Syntax error at token %a@,%t@]" pp_hint token msg
|
||||
"@[<v>Syntax error at token %a@,%t@]"
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string)
|
||||
token msg
|
||||
|
||||
module ParserAux (LocalisedLexer : Lexer_common.LocalisedLexer) = struct
|
||||
include Parser.Make (LocalisedLexer)
|
||||
@ -162,55 +125,30 @@ module ParserAux (LocalisedLexer : Lexer_common.LocalisedLexer) = struct
|
||||
| None -> token_list, None
|
||||
in
|
||||
let similar_acceptable_tokens =
|
||||
List.sort
|
||||
(fun (x, _) (y, _) ->
|
||||
let truncated_x =
|
||||
if String.length wrong_token <= String.length x then
|
||||
String.sub x 0 (String.length wrong_token)
|
||||
else x
|
||||
in
|
||||
let truncated_y =
|
||||
if String.length wrong_token <= String.length y then
|
||||
String.sub y 0 (String.length wrong_token)
|
||||
else y
|
||||
in
|
||||
let levx = levenshtein_distance truncated_x wrong_token in
|
||||
let levy = levenshtein_distance truncated_y wrong_token in
|
||||
if levx = levy then String.length x - String.length y else levx - levy)
|
||||
acceptable_tokens
|
||||
in
|
||||
let similar_token_msg =
|
||||
match similar_acceptable_tokens with
|
||||
| [] -> None
|
||||
| tokens ->
|
||||
Some
|
||||
(fun ppf ->
|
||||
Format.fprintf ppf "did you mean %a?"
|
||||
(Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ or@ maybe@ ")
|
||||
(fun ppf (ts, _) -> pp_hint ppf ts))
|
||||
tokens)
|
||||
Suggestions.suggestion_minimum_levenshtein_distance_association
|
||||
(List.map (fun (s, _) -> s) acceptable_tokens)
|
||||
wrong_token
|
||||
in
|
||||
(* The parser has suspended itself because of a syntax error. Stop. *)
|
||||
let custom_menhir_message ppf =
|
||||
match Parser_errors.message (state env) with
|
||||
(match Parser_errors.message (state env) with
|
||||
| exception Not_found ->
|
||||
Format.fprintf ppf "Message: @{<yellow>unexpected token@}"
|
||||
Format.fprintf ppf "Message: @{<yellow>unexpected token@}@,%t"
|
||||
| msg ->
|
||||
Format.fprintf ppf "Message: @{<yellow>%s@}"
|
||||
(String.trim (String.uncapitalize_ascii msg))
|
||||
Format.fprintf ppf "Message: @{<yellow>%s@}@,%t"
|
||||
(String.trim (String.uncapitalize_ascii msg)))
|
||||
(fun (ppf : Format.formatter) ->
|
||||
Format.fprintf ppf "You could have written : ";
|
||||
Format.pp_print_list
|
||||
~pp_sep:(fun ppf () -> Format.fprintf ppf ",@ or ")
|
||||
(fun ppf string -> Format.fprintf ppf "@{<yellow>\"%s\"@}" string)
|
||||
ppf
|
||||
(List.map (fun (s, _) -> s) acceptable_tokens))
|
||||
in
|
||||
let msg ppf =
|
||||
match similar_token_msg with
|
||||
| None -> custom_menhir_message ppf
|
||||
| Some similar_token_msg ->
|
||||
Format.fprintf ppf "@[<v>%t@,@[<hov 4>Autosuggestion: %t@]@]"
|
||||
custom_menhir_message similar_token_msg
|
||||
in
|
||||
raise_parser_error
|
||||
raise_parser_error ~suggestion:similar_acceptable_tokens
|
||||
(Pos.from_lpos (lexing_positions lexbuf))
|
||||
(Option.map Pos.from_lpos last_positions)
|
||||
(Utf8.lexeme lexbuf) msg
|
||||
(Utf8.lexeme lexbuf) custom_menhir_message
|
||||
|
||||
(** Main parsing loop *)
|
||||
let rec loop
|
||||
|
@ -28,9 +28,11 @@ scope Test1:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test1
|
||||
[ERROR] Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
Autosuggestion: did you mean "content", or maybe "condition"?
|
||||
[ERROR]
|
||||
Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
You could have written : "condition",
|
||||
or "content"
|
||||
|
||||
Error token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
|
||||
@ -38,13 +40,11 @@ Error token:
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾
|
||||
|
||||
|
||||
Last good token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
|
||||
└──┐
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
@ -72,9 +72,11 @@ scope Test2:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test2
|
||||
[ERROR] Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
Autosuggestion: did you mean "content", or maybe "condition"?
|
||||
[ERROR]
|
||||
Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
You could have written : "condition",
|
||||
or "content"
|
||||
|
||||
Error token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
|
||||
@ -82,13 +84,11 @@ Error token:
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾
|
||||
|
||||
|
||||
Last good token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
|
||||
└──┐
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
@ -116,9 +116,11 @@ scope Test3:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test3
|
||||
[ERROR] Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
Autosuggestion: did you mean "content", or maybe "condition"?
|
||||
[ERROR]
|
||||
Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
You could have written : "condition",
|
||||
or "content"
|
||||
|
||||
Error token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
|
||||
@ -126,13 +128,11 @@ Error token:
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾
|
||||
|
||||
|
||||
Last good token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
|
||||
└──┐
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
@ -162,9 +162,11 @@ scope Test4:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test4
|
||||
[ERROR] Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
Autosuggestion: did you mean "content", or maybe "condition"?
|
||||
[ERROR]
|
||||
Syntax error at token "scope"
|
||||
Message: expected either 'condition', or 'content' followed by the expected variable type
|
||||
You could have written : "condition",
|
||||
or "content"
|
||||
|
||||
Error token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.21-11.26:
|
||||
@ -172,12 +174,10 @@ Error token:
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾
|
||||
|
||||
|
||||
Last good token:
|
||||
┌─⯈ examples/NSW_community_gaming/tests/test_nsw_social_housie.catala_en:11.11-11.20:
|
||||
└──┐
|
||||
11 │ context my_gaming scope GamingAuthorized
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -283,7 +283,7 @@ let driver_lwt
|
||||
Lwt.return 0
|
||||
with Message.CompilerError content ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content content Error;
|
||||
Message.Content.emit content Error;
|
||||
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
|
||||
Lwt.return (-1)
|
||||
|
||||
@ -293,7 +293,7 @@ let driver file debug diff expiration custom_date client_id client_secret =
|
||||
(driver_lwt file debug diff expiration custom_date client_id client_secret)
|
||||
with Message.CompilerError content ->
|
||||
let bt = Printexc.get_raw_backtrace () in
|
||||
Message.emit_content content Error;
|
||||
Message.Content.emit content Error;
|
||||
if Printexc.backtrace_status () then Printexc.print_raw_backtrace stderr bt;
|
||||
-1
|
||||
|
||||
|
60
french_law/js/yarn.lock
generated
60
french_law/js/yarn.lock
generated
@ -3,42 +3,42 @@
|
||||
|
||||
|
||||
"@catala-lang/rescript-catala@^0.8.1-b.0":
|
||||
version "0.8.1-b.0"
|
||||
resolved "https://registry.npmjs.org/@catala-lang/rescript-catala/-/rescript-catala-0.8.1-b.0.tgz"
|
||||
integrity sha512-rOCwTFZE8u7r1WUqohU5r1Aq/cNJYZEJ4/S/MEJkrKUrwdV7tU0Pr8bU6i0MuYRWssclEUUy38yx2mm2dD29Cg==
|
||||
"integrity" "sha512-rOCwTFZE8u7r1WUqohU5r1Aq/cNJYZEJ4/S/MEJkrKUrwdV7tU0Pr8bU6i0MuYRWssclEUUy38yx2mm2dD29Cg=="
|
||||
"resolved" "https://registry.npmjs.org/@catala-lang/rescript-catala/-/rescript-catala-0.8.1-b.0.tgz"
|
||||
"version" "0.8.1-b.0"
|
||||
dependencies:
|
||||
decco "^1.6.0"
|
||||
rescript "^10.1.4"
|
||||
"decco" "^1.6.0"
|
||||
"rescript" "^10.1.4"
|
||||
|
||||
benchmark@^2.1.4:
|
||||
version "2.1.4"
|
||||
resolved "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz"
|
||||
integrity sha1-CfPeMckWQl1JjMLuVloOvzwqVik=
|
||||
"benchmark@^2.1.4":
|
||||
"integrity" "sha1-CfPeMckWQl1JjMLuVloOvzwqVik="
|
||||
"resolved" "https://registry.npmjs.org/benchmark/-/benchmark-2.1.4.tgz"
|
||||
"version" "2.1.4"
|
||||
dependencies:
|
||||
lodash "^4.17.4"
|
||||
platform "^1.3.3"
|
||||
"lodash" "^4.17.4"
|
||||
"platform" "^1.3.3"
|
||||
|
||||
"bs-platform@6 || 7 || 8 || 9":
|
||||
version "9.0.2"
|
||||
resolved "https://registry.npmjs.org/bs-platform/-/bs-platform-9.0.2.tgz"
|
||||
integrity sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA==
|
||||
"integrity" "sha512-Ye9JqJ4Oa7mcjjoOVRYI8Uc2Cf8N7jQLWDcdUplY7996d/YErSR7WitmV7XnSwr4EvdrbwjEsg1NxNjUQv3ChA=="
|
||||
"resolved" "https://registry.npmjs.org/bs-platform/-/bs-platform-9.0.2.tgz"
|
||||
"version" "9.0.2"
|
||||
|
||||
decco@^1.6.0:
|
||||
version "1.6.0"
|
||||
resolved "https://registry.npmjs.org/decco/-/decco-1.6.0.tgz"
|
||||
integrity sha512-gdeDDPOh45Hz8YGvTkDP7ySo3Ll3ty+KfuFj21+jRbiCoE8HTCNB++pozCiMljxJx39CfvrHRYBY5FO5PMyXzw==
|
||||
"decco@^1.6.0":
|
||||
"integrity" "sha512-gdeDDPOh45Hz8YGvTkDP7ySo3Ll3ty+KfuFj21+jRbiCoE8HTCNB++pozCiMljxJx39CfvrHRYBY5FO5PMyXzw=="
|
||||
"resolved" "https://registry.npmjs.org/decco/-/decco-1.6.0.tgz"
|
||||
"version" "1.6.0"
|
||||
|
||||
lodash@^4.17.21, lodash@^4.17.4:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
"lodash@^4.17.21", "lodash@^4.17.4":
|
||||
"integrity" "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
"resolved" "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz"
|
||||
"version" "4.17.21"
|
||||
|
||||
platform@^1.3.3, platform@^1.3.6:
|
||||
version "1.3.6"
|
||||
resolved "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz"
|
||||
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
|
||||
"platform@^1.3.3", "platform@^1.3.6":
|
||||
"integrity" "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg=="
|
||||
"resolved" "https://registry.npmjs.org/platform/-/platform-1.3.6.tgz"
|
||||
"version" "1.3.6"
|
||||
|
||||
rescript@^10.1.4:
|
||||
version "10.1.4"
|
||||
resolved "https://registry.npmjs.org/rescript/-/rescript-10.1.4.tgz"
|
||||
integrity sha512-FFKlS9AG/XrLepWsyw7B+A9DtQBPWEPDPDKghV831Y2KGbie+eeFBOS0xtRHp0xbt7S0N2Dm6hhX+kTZQ/3Ybg==
|
||||
"rescript@^10.1.4":
|
||||
"integrity" "sha512-FFKlS9AG/XrLepWsyw7B+A9DtQBPWEPDPDKghV831Y2KGbie+eeFBOS0xtRHp0xbt7S0N2Dm6hhX+kTZQ/3Ybg=="
|
||||
"resolved" "https://registry.npmjs.org/rescript/-/rescript-10.1.4.tgz"
|
||||
"version" "10.1.4"
|
||||
|
@ -33,7 +33,8 @@ scope Money:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Dec
|
||||
[ERROR] division by zero at runtime
|
||||
[ERROR]
|
||||
division by zero at runtime
|
||||
|
||||
The division operator:
|
||||
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:20.23-20.30:
|
||||
@ -55,7 +56,8 @@ The null denominator:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Int
|
||||
[ERROR] division by zero at runtime
|
||||
[ERROR]
|
||||
division by zero at runtime
|
||||
|
||||
The division operator:
|
||||
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:10.23-10.28:
|
||||
@ -77,7 +79,8 @@ The null denominator:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Money
|
||||
[ERROR] division by zero at runtime
|
||||
[ERROR]
|
||||
division by zero at runtime
|
||||
|
||||
The division operator:
|
||||
┌─⯈ tests/test_arithmetic/bad/division_by_zero.catala_en:30.23-30.35:
|
||||
|
@ -8,18 +8,17 @@ scope S1:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Please add parentheses to explicit which of these operators should be applied first
|
||||
[ERROR]
|
||||
Please add parentheses to explicit which of these operators should be applied first
|
||||
|
||||
┌─⯈ tests/test_arithmetic/bad/logical_prio.catala_en:6.28-6.31:
|
||||
└─┐
|
||||
6 │ definition o equals true and (false and true and true) or false
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
┌─⯈ tests/test_arithmetic/bad/logical_prio.catala_en:6.58-6.60:
|
||||
└─┐
|
||||
6 │ definition o equals true and (false and true and true) or false
|
||||
│ ‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,7 +12,9 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] I don't know how to apply operator >= on types integer and money
|
||||
[ERROR]
|
||||
I don't know how to apply operator >= on types integer and
|
||||
money
|
||||
|
||||
┌─⯈ tests/test_array/bad/fold_error.catala_en:10.50-10.52:
|
||||
└──┐
|
||||
|
@ -12,9 +12,10 @@ scope Foo:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Foo
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_bool/bad/bad_assert.catala_en:9.13-9.14:
|
||||
|
@ -10,9 +10,10 @@ scope TestXorWithInt:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ bool
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_bool/bad/test_xor_with_int.catala_en:8.30-8.32:
|
||||
|
@ -25,18 +25,17 @@ scope Test:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Test
|
||||
[ERROR] You cannot set multiple date rounding modes
|
||||
[ERROR]
|
||||
You cannot set multiple date rounding modes
|
||||
|
||||
┌─⯈ tests/test_date/bad/rounding_option_conflict.catala_en:10.14-10.24:
|
||||
└──┐
|
||||
10 │ date round decreasing
|
||||
│ ‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
┌─⯈ tests/test_date/bad/rounding_option_conflict.catala_en:12.14-12.24:
|
||||
└──┐
|
||||
12 │ date round increasing
|
||||
│ ‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -42,7 +42,8 @@ scope Ge:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Ge
|
||||
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
|
||||
[ERROR]
|
||||
Cannot compare together durations that cannot be converted to a precise number of days
|
||||
|
||||
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:40.23-40.30:
|
||||
└──┐
|
||||
@ -62,7 +63,8 @@ $ catala Interpret -s Ge
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Gt
|
||||
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
|
||||
[ERROR]
|
||||
Cannot compare together durations that cannot be converted to a precise number of days
|
||||
|
||||
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:30.23-30.30:
|
||||
└──┐
|
||||
@ -82,7 +84,8 @@ $ catala Interpret -s Gt
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Le
|
||||
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
|
||||
[ERROR]
|
||||
Cannot compare together durations that cannot be converted to a precise number of days
|
||||
|
||||
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:20.23-20.30:
|
||||
└──┐
|
||||
@ -102,7 +105,8 @@ $ catala Interpret -s Le
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Lt
|
||||
[ERROR] Cannot compare together durations that cannot be converted to a precise number of days
|
||||
[ERROR]
|
||||
Cannot compare together durations that cannot be converted to a precise number of days
|
||||
|
||||
┌─⯈ tests/test_date/bad/uncomparable_duration.catala_en:10.23-10.30:
|
||||
└──┐
|
||||
|
@ -10,21 +10,9 @@ scope A:
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
|
||||
This consequence has a valid justification:
|
||||
┌─⯈ tests/test_default/bad/conflict.catala_en:8.56-8.57:
|
||||
└─┐
|
||||
8 │ definition x under condition true consequence equals 1
|
||||
│ ‾
|
||||
└─ Article
|
||||
|
||||
This consequence has a valid justification:
|
||||
┌─⯈ tests/test_default/bad/conflict.catala_en:9.56-9.57:
|
||||
└─┐
|
||||
9 │ definition x under condition true consequence equals 0
|
||||
│ ‾
|
||||
└─ Article
|
||||
$ catala Interpret -s A --message=gnu
|
||||
tests/test_default/bad/conflict.catala_en:8.56-8.57: [ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
tests/test_default/bad/conflict.catala_en:8.56-8.57: [ERROR] This consequence has a valid justification:
|
||||
tests/test_default/bad/conflict.catala_en:9.56-9.57: [ERROR] This consequence has a valid justification:
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -18,7 +18,8 @@ $ catala Interpret -s A
|
||||
6 │ output y content boolean
|
||||
│ ‾
|
||||
└─ Article
|
||||
[ERROR] This variable evaluated to an empty term (no rule that defined it applied in this situation)
|
||||
[ERROR]
|
||||
This variable evaluated to an empty term (no rule that defined it applied in this situation)
|
||||
|
||||
┌─⯈ tests/test_default/bad/empty.catala_en:6.10-6.11:
|
||||
└─┐
|
||||
|
@ -14,7 +14,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This variable evaluated to an empty term (no rule that defined it applied in this situation)
|
||||
[ERROR]
|
||||
This variable evaluated to an empty term (no rule that defined it applied in this situation)
|
||||
|
||||
┌─⯈ tests/test_default/bad/empty_with_rules.catala_en:5.10-5.11:
|
||||
└─┐
|
||||
|
37
tests/test_default/bad/typing_or_logical_error.catala_en
Normal file
37
tests/test_default/bad/typing_or_logical_error.catala_en
Normal file
@ -0,0 +1,37 @@
|
||||
###Article
|
||||
|
||||
```catala
|
||||
declaration scope A:
|
||||
output wrong_definition content integer
|
||||
|
||||
scope A:
|
||||
definition wrong_definition = 1
|
||||
```
|
||||
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR]
|
||||
Syntax error at token "="
|
||||
Message: expected 'under condition' followed by a condition, 'equals' followed by the definition body, or the rest of the variable qualified name
|
||||
You could have written : "of",
|
||||
or "state",
|
||||
or "equals",
|
||||
or "under condition",
|
||||
or "."
|
||||
|
||||
Error token:
|
||||
┌─⯈ tests/test_default/bad/typing_or_logical_error.catala_en:8.30-8.31:
|
||||
└─┐
|
||||
8 │ definition wrong_definition = 1
|
||||
│ ‾
|
||||
|
||||
Last good token:
|
||||
┌─⯈ tests/test_default/bad/typing_or_logical_error.catala_en:8.13-8.29:
|
||||
└─┐
|
||||
8 │ definition wrong_definition = 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
Maybe you wanted to write : "."
|
||||
#return code 123#
|
||||
```
|
@ -18,12 +18,10 @@ $ catala Interpret -s A
|
||||
9 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
┌─⯈ tests/test_default/good/mutliple_definitions.catala_en:6.3-6.15:
|
||||
└─┐
|
||||
6 │ definition w equals 3
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
[RESULT] Computation successful! Results:
|
||||
[RESULT] w = 3
|
||||
```
|
||||
|
@ -16,7 +16,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This constructor name is ambiguous, it can belong to E or F. Desambiguate it by prefixing it with the enum name.
|
||||
[ERROR]
|
||||
This constructor name is ambiguous, it can belong to E or F. Desambiguate it by prefixing it with the enum name.
|
||||
|
||||
┌─⯈ tests/test_enum/bad/ambiguous_cases.catala_en:14.23-14.28:
|
||||
└──┐
|
||||
|
@ -17,7 +17,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Couldn't infer the enumeration name from lonely wildcard (wildcard cannot be used as single match case)
|
||||
[ERROR]
|
||||
Couldn't infer the enumeration name from lonely wildcard (wildcard cannot be used as single match case)
|
||||
|
||||
┌─⯈ tests/test_enum/bad/ambiguous_wildcard.catala_en:15.5-15.21:
|
||||
└──┐
|
||||
|
@ -20,7 +20,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] The constructor Case3 has been matched twice:
|
||||
[ERROR]
|
||||
The constructor Case3 has been matched twice:
|
||||
|
||||
┌─⯈ tests/test_enum/bad/duplicate_case.catala_en:18.16-18.20:
|
||||
└──┐
|
||||
|
@ -9,7 +9,8 @@ declaration scope Bar:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] The enum Foo does not have any cases; give it some for Catala to be able to accept it.
|
||||
[ERROR]
|
||||
The enum Foo does not have any cases; give it some for Catala to be able to accept it.
|
||||
|
||||
┌─⯈ tests/test_enum/bad/empty.catala_en:4.25-4.28:
|
||||
└─┐
|
||||
|
@ -25,7 +25,8 @@ $ catala Interpret -s A
|
||||
7 │ -- Case3
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
[ERROR] The constructor Case3 of enum E is missing from this pattern matching
|
||||
[ERROR]
|
||||
The constructor Case3 of enum E is missing from this pattern matching
|
||||
|
||||
┌─⯈ tests/test_enum/bad/missing_case.catala_en:14.25-16.22:
|
||||
└──┐
|
||||
|
@ -38,7 +38,8 @@ scope Middle_case:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s First_case
|
||||
[ERROR] Wildcard must be the last match case
|
||||
[ERROR]
|
||||
Wildcard must be the last match case
|
||||
|
||||
Not ending wildcard:
|
||||
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
@ -60,7 +61,8 @@ Next reachable case:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s Middle_case
|
||||
[ERROR] Wildcard must be the last match case
|
||||
[ERROR]
|
||||
Wildcard must be the last match case
|
||||
|
||||
Not ending wildcard:
|
||||
┌─⯈ tests/test_enum/bad/not_ending_wildcard.catala_en:19.5-19.21:
|
||||
|
@ -30,9 +30,10 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_enum/bad/quick_pattern_2.catala_en:28.23-28.24:
|
||||
|
@ -20,9 +20,10 @@ definition y equals x with pattern Case3
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_enum/bad/quick_pattern_3.catala_en:18.21-18.22:
|
||||
|
@ -19,9 +19,10 @@ definition y equals x with pattern Case3
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ E
|
||||
└─⯈ F
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_enum/bad/quick_pattern_4.catala_en:17.21-17.22:
|
||||
|
@ -17,12 +17,18 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] The name of this constructor has not been defined before, maybe it is a typo?
|
||||
[ERROR]
|
||||
The name of this constructor has not been defined before
|
||||
(it's probably a typographical error).
|
||||
|
||||
Here is your code :
|
||||
┌─⯈ tests/test_enum/bad/quick_pattern_fail.catala_en:15.38-15.43:
|
||||
└──┐
|
||||
15 │ definition y equals x with pattern Case3
|
||||
│ ‾‾‾‾‾
|
||||
└─ Article
|
||||
|
||||
Maybe you wanted to write : "Case1",
|
||||
or "Case2"
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -23,7 +23,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This case matches a constructor of enumeration E but previous case were matching constructors of enumeration F
|
||||
[ERROR]
|
||||
This case matches a constructor of enumeration E but previous case were matching constructors of enumeration F
|
||||
|
||||
┌─⯈ tests/test_enum/bad/too_many_cases.catala_en:21.8-21.13:
|
||||
└──┐
|
||||
|
29
tests/test_enum/bad/wrong_cons.catala_en
Normal file
29
tests/test_enum/bad/wrong_cons.catala_en
Normal file
@ -0,0 +1,29 @@
|
||||
## Article
|
||||
|
||||
```catala
|
||||
declaration enumeration E:
|
||||
-- Case1
|
||||
|
||||
declaration scope A:
|
||||
context e content E
|
||||
|
||||
scope A:
|
||||
definition e equals Case2
|
||||
```
|
||||
|
||||
```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/test_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#
|
||||
```
|
@ -15,7 +15,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This exception can refer to several definitions. Try using labels to disambiguate
|
||||
[ERROR]
|
||||
This exception can refer to several definitions. Try using labels to disambiguate
|
||||
|
||||
Ambiguous exception
|
||||
┌─⯈ tests/test_exception/bad/ambiguous_unlabeled_exception.catala_en:12.3-13.15:
|
||||
|
@ -15,7 +15,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Unknown label for the scope variable x: "base_y"
|
||||
[ERROR]
|
||||
Unknown label for the scope variable x: "base_y"
|
||||
|
||||
┌─⯈ tests/test_exception/bad/dangling_exception.catala_en:12.13-12.19:
|
||||
└──┐
|
||||
|
@ -20,7 +20,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Exception cycle detected when defining x: each of these 3 exceptions applies over the previous one, and the first applies over the last
|
||||
[ERROR]
|
||||
Exception cycle detected when defining x: each of these 3 exceptions applies over the previous one, and the first applies over the last
|
||||
|
||||
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:8.3-10.15:
|
||||
└──┐
|
||||
@ -31,7 +32,6 @@ $ catala Interpret -s A
|
||||
10 │ definition x equals 0
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:12.3-14.15:
|
||||
└──┐
|
||||
12 │ label exception_x
|
||||
@ -41,7 +41,6 @@ $ catala Interpret -s A
|
||||
14 │ definition x equals 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
┌─⯈ tests/test_exception/bad/exceptions_cycle.catala_en:16.3-18.15:
|
||||
└──┐
|
||||
16 │ label exception_exception_x
|
||||
@ -50,6 +49,5 @@ $ catala Interpret -s A
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
18 │ definition x equals 2
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -11,7 +11,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This exception does not have a corresponding definition
|
||||
[ERROR]
|
||||
This exception does not have a corresponding definition
|
||||
|
||||
┌─⯈ tests/test_exception/bad/missing_unlabeled_definition.catala_en:8.3-9.15:
|
||||
└─┐
|
||||
|
@ -21,7 +21,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] This exception can refer to several definitions. Try using labels to disambiguate
|
||||
[ERROR]
|
||||
This exception can refer to several definitions. Try using labels to disambiguate
|
||||
|
||||
Ambiguous exception
|
||||
┌─⯈ tests/test_exception/bad/one_ambiguous_exception.catala_en:18.3-19.15:
|
||||
|
@ -12,7 +12,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Cannot define rule as an exception to itself
|
||||
[ERROR]
|
||||
Cannot define rule as an exception to itself
|
||||
|
||||
┌─⯈ tests/test_exception/bad/self_exception.catala_en:9.13-9.19:
|
||||
└─┐
|
||||
|
@ -17,7 +17,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
[ERROR]
|
||||
There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
|
||||
This consequence has a valid justification:
|
||||
┌─⯈ tests/test_exception/bad/two_exceptions.catala_en:12.23-12.24:
|
||||
|
@ -29,7 +29,8 @@ $ catala Interpret -s R
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s S
|
||||
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
[ERROR]
|
||||
There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
|
||||
This consequence has a valid justification:
|
||||
┌─⯈ tests/test_func/bad/bad_func.catala_en:14.65-14.70:
|
||||
|
@ -14,7 +14,8 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
[ERROR]
|
||||
Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency.catala_en:4.42-4.43:
|
||||
@ -22,12 +23,10 @@ Argument declared here:
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency.catala_en:10.20-10.21:
|
||||
└──┐
|
||||
10 │ definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -13,7 +13,8 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
[ERROR]
|
||||
Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency2.catala_en:4.42-4.43:
|
||||
@ -21,12 +22,10 @@ Argument declared here:
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency2.catala_en:9.30-9.31:
|
||||
└─┐
|
||||
9 │ exception definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -13,7 +13,8 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
[ERROR]
|
||||
Function argument name mismatch between declaration ('x') and definition ('y')
|
||||
|
||||
Argument declared here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency3.catala_en:4.42-4.43:
|
||||
@ -21,12 +22,10 @@ Argument declared here:
|
||||
4 │ internal f1 content decimal depends on x content integer
|
||||
│ ‾
|
||||
|
||||
|
||||
Defined here:
|
||||
┌─⯈ tests/test_func/bad/param_inconsistency3.catala_en:9.30-9.31:
|
||||
└─┐
|
||||
9 │ exception definition f1 of y under condition not cond
|
||||
│ ‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -10,7 +10,8 @@ scope RecursiveFunc:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s RecursiveFunc
|
||||
[ERROR] The variable f is used in one of its definitions, but recursion is forbidden in Catala
|
||||
[ERROR]
|
||||
The variable f is used in one of its definitions, but recursion is forbidden in Catala
|
||||
|
||||
┌─⯈ tests/test_func/bad/recursive.catala_en:8.28-8.29:
|
||||
└─┐
|
||||
|
@ -17,7 +17,8 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Scopelang -s B
|
||||
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
|
||||
@ -38,13 +39,13 @@ Incriminated subscope variable definition:
|
||||
└──┐
|
||||
15 │ definition a.f of x under condition b and x > 0 consequence equals x - 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc -s A
|
||||
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
|
||||
@ -65,13 +66,13 @@ Incriminated subscope variable definition:
|
||||
└──┐
|
||||
15 │ definition a.f of x under condition b and x > 0 consequence equals x - 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Dcalc -s B
|
||||
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_func/good/context_func.catala_en:9.3-9.4:
|
||||
@ -92,6 +93,5 @@ Incriminated subscope variable definition:
|
||||
└──┐
|
||||
15 │ definition a.f of x under condition b and x > 0 consequence equals x - 1
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,7 +16,8 @@ scope B:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] This subscope variable is a mandatory input but no definition was provided.
|
||||
[ERROR]
|
||||
This subscope variable is a mandatory input but no definition was provided.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_io/bad/forgot_input.catala_en:9.3-9.4:
|
||||
|
@ -16,7 +16,8 @@ scope B:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_io/bad/inputing_to_not_input.catala_en:8.3-8.4:
|
||||
@ -37,6 +38,5 @@ Incriminated subscope variable definition:
|
||||
└──┐
|
||||
14 │ definition a.a equals 0
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -9,7 +9,8 @@ scope A:
|
||||
```
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] It is impossible to give a definition to a scope variable tagged as input.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a scope variable tagged as input.
|
||||
|
||||
Incriminated variable:
|
||||
┌─⯈ tests/test_io/bad/redefining_input.catala_en:5.16-5.17:
|
||||
@ -23,6 +24,5 @@ Incriminated variable definition:
|
||||
└─┐
|
||||
8 │ definition a equals 0
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -22,7 +22,8 @@ $ catala Typecheck
|
||||
5 │ internal a content integer
|
||||
│ ‾
|
||||
└─ Test
|
||||
[ERROR] The variable a.a cannot be used here, as it is not part of subscope a's results. Maybe you forgot to qualify it as an output?
|
||||
[ERROR]
|
||||
The variable a.a cannot be used here, as it is not part of subscope a's results. Maybe you forgot to qualify it as an output?
|
||||
|
||||
Incriminated variable usage:
|
||||
┌─⯈ tests/test_io/bad/using_non_output.catala_en:14.13-14.16:
|
||||
|
@ -14,7 +14,9 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] I don't know how to apply operator * on types money and money
|
||||
[ERROR]
|
||||
I don't know how to apply operator * on types money and
|
||||
money
|
||||
|
||||
┌─⯈ tests/test_money/bad/no_mingle.catala_en:12.26-12.27:
|
||||
└──┐
|
||||
|
@ -13,7 +13,8 @@ declaration glob5 content decimal
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Scope calls are not allowed outside of a scope
|
||||
[ERROR]
|
||||
Scope calls are not allowed outside of a scope
|
||||
|
||||
┌─⯈ tests/test_name_resolution/bad/toplevel_defs.catala_en:11.11-11.23:
|
||||
└──┐
|
||||
|
@ -29,6 +29,5 @@ $ catala Proof --disable_counterexamples
|
||||
└─┐
|
||||
4 │ output x content integer
|
||||
│ ‾
|
||||
|
||||
Counterexample generation is disabled so none was generated.
|
||||
```
|
||||
|
@ -15,7 +15,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Proof --disable_counterexamples
|
||||
[ERROR] It is impossible to give a definition to a scope variable tagged as input.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a scope variable tagged as input.
|
||||
|
||||
Incriminated variable:
|
||||
┌─⯈ tests/test_proof/bad/dates_get_year-empty.catala_en:5.9-5.10:
|
||||
@ -29,6 +30,5 @@ Incriminated variable definition:
|
||||
└─┐
|
||||
9 │ definition x equals |2022-01-16|
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -123,7 +123,8 @@ scope Amount:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Proof --disable_counterexamples
|
||||
[ERROR] It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
[ERROR]
|
||||
It is impossible to give a definition to a subscope variable not tagged as input or context.
|
||||
|
||||
Incriminated subscope:
|
||||
┌─⯈ tests/test_proof/bad/prolala_motivating_example.catala_en:56.3-56.14:
|
||||
@ -146,6 +147,5 @@ Incriminated subscope variable definition:
|
||||
└──┐
|
||||
64 │ definition eligibility.is_student equals is_student
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,8 +16,9 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Cyclic dependency detected between the following variables of scope A:
|
||||
z → x → y → z
|
||||
[ERROR]
|
||||
Cyclic dependency detected between the following variables of scope A:
|
||||
z → x → y → z
|
||||
|
||||
z is used here in the definition of x:
|
||||
┌─⯈ tests/test_scope/bad/cycle_in_scope.catala_en:14.23-14.24:
|
||||
|
@ -28,8 +28,9 @@ scope S4:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala typecheck
|
||||
[ERROR] Cyclic dependency detected between the following scopes:
|
||||
S4 → S3 → S2 → S4
|
||||
[ERROR]
|
||||
Cyclic dependency detected between the following scopes:
|
||||
S4 → S3 → S2 → S4
|
||||
|
||||
S4 is used here in the definition of S3:
|
||||
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:21.24-21.36:
|
||||
@ -37,19 +38,16 @@ S4 is used here in the definition of S3:
|
||||
21 │ definition o equals (output of S4).o
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
S3 is used here in the definition of S2:
|
||||
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:18.43-18.55:
|
||||
└──┐
|
||||
18 │ definition o equals (output of S1).o + (output of S3).o
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
S2 is used here in the definition of S4:
|
||||
┌─⯈ tests/test_scope/bad/cyclic_scope_calls.catala_en:24.24-24.36:
|
||||
└──┐
|
||||
24 │ definition o equals (output of S2).o
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -18,8 +18,8 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Cyclic dependency detected between the following scopes:
|
||||
B → A → B
|
||||
[ERROR]
|
||||
Cyclic dependency detected between the following scopes: B → A → B
|
||||
|
||||
B is used here in the definition of A:
|
||||
┌─⯈ tests/test_scope/bad/cyclic_scopes.catala_en:5.3-5.4:
|
||||
|
@ -16,7 +16,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
[ERROR]
|
||||
There is a conflict between multiple valid consequences for assigning the same variable.
|
||||
|
||||
This consequence has a valid justification:
|
||||
┌─⯈ tests/test_scope/bad/scope.catala_en:13.57-13.61:
|
||||
|
@ -16,12 +16,12 @@ scope Titi:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala dcalc -s Titi
|
||||
[ERROR] Duplicate definition of scope input variable 'bar'
|
||||
[ERROR]
|
||||
Duplicate definition of scope input variable 'bar'
|
||||
|
||||
┌─⯈ tests/test_scope/bad/scope_call_duplicate.catala_en:14.70-14.73:
|
||||
└──┐
|
||||
14 │ definition fizz equals output of Toto with {--bar: 1 --baz: 2.1 -- bar: 3}
|
||||
│ ‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,19 +16,18 @@ scope Titi:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala dcalc -s Titi
|
||||
[ERROR] Scope Toto has no input variable biz
|
||||
[ERROR]
|
||||
Scope Toto has no input variable biz
|
||||
|
||||
┌─⯈ tests/test_scope/bad/scope_call_extra.catala_en:14.49-14.52:
|
||||
└──┐
|
||||
14 │ definition fizz equals output of Toto with {--biz: 1}
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Scope Toto declared here
|
||||
┌─⯈ tests/test_scope/bad/scope_call_extra.catala_en:2.19-2.23:
|
||||
└─┐
|
||||
2 │ declaration scope Toto:
|
||||
│ ‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,19 +16,18 @@ scope Titi:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala dcalc -s Titi
|
||||
[ERROR] Definition of input variable 'baz' missing in this scope call
|
||||
[ERROR]
|
||||
Definition of input variable 'baz' missing in this scope call
|
||||
|
||||
┌─⯈ tests/test_scope/bad/scope_call_missing.catala_en:14.26-14.56:
|
||||
└──┐
|
||||
14 │ definition fizz equals output of Toto with {--bar: 1}
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
Declaration of the missing input variable
|
||||
┌─⯈ tests/test_scope/bad/scope_call_missing.catala_en:4.16-4.19:
|
||||
└─┐
|
||||
4 │ input output baz content decimal
|
||||
│ ‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -15,7 +15,8 @@ scope B:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] The subscope a is used when defining one of its inputs, but recursion is forbidden in Catala
|
||||
[ERROR]
|
||||
The subscope a is used when defining one of its inputs, but recursion is forbidden in Catala
|
||||
|
||||
┌─⯈ tests/test_scope/bad/sub_vars_in_sub_var.catala_en:13.28-13.31:
|
||||
└──┐
|
||||
|
@ -35,7 +35,6 @@ $ catala Interpret -t -s HousingComputation --debug
|
||||
└─┐
|
||||
8 │ definition result equals f of 1
|
||||
│ ‾‾‾‾‾‾
|
||||
|
||||
[LOG] → HousingComputation.f
|
||||
[LOG] ≔ HousingComputation.f.input0: 1
|
||||
[LOG] ☛ Definition applied:
|
||||
@ -43,7 +42,6 @@ $ catala Interpret -t -s HousingComputation --debug
|
||||
└─┐
|
||||
7 │ definition f of x equals (output of RentComputation).f of x
|
||||
│ ‾
|
||||
|
||||
[LOG] → RentComputation.direct
|
||||
[LOG] ≔ RentComputation.direct.input: {RentComputation_in}
|
||||
[LOG] ≔ RentComputation.g: <function>
|
||||
@ -53,7 +51,6 @@ $ catala Interpret -t -s HousingComputation --debug
|
||||
└─┐
|
||||
7 │ definition f of x equals (output of RentComputation).f of x
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
[LOG] ≔ RentComputation.direct.output: { RentComputation f = <function>; }
|
||||
[LOG] ← RentComputation.direct
|
||||
[LOG] → RentComputation.f
|
||||
@ -63,7 +60,6 @@ $ catala Interpret -t -s HousingComputation --debug
|
||||
└──┐
|
||||
16 │ definition f of x equals g of (x + 1)
|
||||
│ ‾
|
||||
|
||||
[LOG] → RentComputation.g
|
||||
[LOG] ≔ RentComputation.g.input0: 2
|
||||
[LOG] ☛ Definition applied:
|
||||
@ -71,7 +67,6 @@ $ catala Interpret -t -s HousingComputation --debug
|
||||
└──┐
|
||||
15 │ definition g of x equals x + 1
|
||||
│ ‾
|
||||
|
||||
[LOG] ≔ RentComputation.g.output: 3
|
||||
[LOG] ← RentComputation.g
|
||||
[LOG] ≔ RentComputation.f.output: 3
|
||||
|
@ -18,7 +18,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] struct name "S" already defined
|
||||
[ERROR]
|
||||
struct name "S" already defined
|
||||
|
||||
First definition:
|
||||
┌─⯈ tests/test_struct/bad/bug_107.catala_en:4.23-4.24:
|
||||
|
@ -9,7 +9,8 @@ declaration scope Bar:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] The struct Foo does not have any fields; give it some for Catala to be able to accept it.
|
||||
[ERROR]
|
||||
The struct Foo does not have any fields; give it some for Catala to be able to accept it.
|
||||
|
||||
┌─⯈ tests/test_struct/bad/empty_struct.catala_en:4.23-4.26:
|
||||
└─┐
|
||||
|
@ -21,7 +21,8 @@ $ catala Interpret -s A
|
||||
6 │ -- Rec content E
|
||||
│ ‾‾‾
|
||||
└─ Article
|
||||
[ERROR] The type E is defined using itself, which is forbidden since Catala does not provide recursive types
|
||||
[ERROR]
|
||||
The type E is defined using itself, which is forbidden since Catala does not provide recursive types
|
||||
|
||||
┌─⯈ tests/test_struct/bad/nested.catala_en:6.18-6.19:
|
||||
└─┐
|
||||
|
@ -36,7 +36,8 @@ $ catala Interpret -s A
|
||||
8 │ declaration enumeration E:
|
||||
│ ‾
|
||||
└─ Article
|
||||
[ERROR] Cyclic dependency detected between types!
|
||||
[ERROR]
|
||||
Cyclic dependency detected between types!
|
||||
|
||||
Cycle type S, declared:
|
||||
┌─⯈ tests/test_struct/bad/nested2.catala_en:4.23-4.24:
|
||||
|
@ -15,7 +15,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] No struct named Fo found
|
||||
[ERROR]
|
||||
No struct named Fo found
|
||||
|
||||
┌─⯈ tests/test_struct/bad/nonexisting_struct.catala_en:13.25-13.27:
|
||||
└──┐
|
||||
|
@ -19,7 +19,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Interpret -s A
|
||||
[ERROR] Field "g" does not belong to structure "Foo", but to "Bar"
|
||||
[ERROR]
|
||||
Field "g" does not belong to structure "Foo", but to "Bar"
|
||||
|
||||
┌─⯈ tests/test_struct/bad/wrong_qualified_field.catala_en:17.23-17.30:
|
||||
└──┐
|
||||
|
@ -12,9 +12,10 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ integer
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ integer
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err1.catala_en:7.23-7.26:
|
||||
@ -22,19 +23,16 @@ Error coming from typechecking the following expression:
|
||||
7 │ Structure { -- i: 4.1 -- e: y };
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type decimal coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err1.catala_en:7.23-7.26:
|
||||
└─┐
|
||||
7 │ Structure { -- i: 4.1 -- e: y };
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:8.18-8.25:
|
||||
└─┐
|
||||
8 │ data i content integer
|
||||
│ ‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,9 +12,10 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ collection
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ collection
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err2.catala_en:10.39-10.42:
|
||||
@ -22,19 +23,16 @@ Error coming from typechecking the following expression:
|
||||
10 │ definition a equals number of (z ++ 1.1) / 2
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type decimal coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err2.catala_en:10.39-10.42:
|
||||
└──┐
|
||||
10 │ definition a equals number of (z ++ 1.1) / 2
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type collection coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err2.catala_en:10.36-10.38:
|
||||
└──┐
|
||||
10 │ definition a equals number of (z ++ 1.1) / 2
|
||||
│ ‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -18,10 +18,10 @@ $ catala Typecheck
|
||||
└─┐
|
||||
4 │ -- Dec content decimal
|
||||
│ ‾‾‾
|
||||
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ decimal
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ decimal
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
|
||||
@ -29,20 +29,17 @@ Error coming from typechecking the following expression:
|
||||
10 │ definition a equals number of (z ++ z) * 2
|
||||
│ ‾
|
||||
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
|
||||
└──┐
|
||||
10 │ definition a equals number of (z ++ z) * 2
|
||||
│ ‾
|
||||
|
||||
|
||||
Type decimal coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
|
||||
└──┐
|
||||
15 │ output a content decimal
|
||||
│ ‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
||||
@ -56,10 +53,10 @@ $ catala ocaml
|
||||
└─┐
|
||||
4 │ -- Dec content decimal
|
||||
│ ‾‾‾
|
||||
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ decimal
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ decimal
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
|
||||
@ -67,19 +64,16 @@ Error coming from typechecking the following expression:
|
||||
10 │ definition a equals number of (z ++ z) * 2
|
||||
│ ‾
|
||||
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err3.catala_en:10.42-10.43:
|
||||
└──┐
|
||||
10 │ definition a equals number of (z ++ z) * 2
|
||||
│ ‾
|
||||
|
||||
|
||||
Type decimal coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:15.20-15.27:
|
||||
└──┐
|
||||
15 │ output a content decimal
|
||||
│ ‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -16,24 +16,22 @@ $ catala ocaml
|
||||
└─┐
|
||||
7 │ declaration structure Structure:
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
[WARNING] The constructor "Dec" of enumeration "Enum" is never used; maybe it's unnecessary?
|
||||
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:4.6-4.9:
|
||||
└─┐
|
||||
4 │ -- Dec content decimal
|
||||
│ ‾‾‾
|
||||
|
||||
[WARNING] The constructor "Dat" of enumeration "Enum" is never used; maybe it's unnecessary?
|
||||
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:5.6-5.9:
|
||||
└─┐
|
||||
5 │ -- Dat content date
|
||||
│ ‾‾‾
|
||||
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ Enum
|
||||
└─⯈ Structure
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ Enum
|
||||
└─⯈ Structure
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err4.catala_en:5.25-5.38:
|
||||
@ -41,19 +39,16 @@ Error coming from typechecking the following expression:
|
||||
5 │ definition z equals [ Int content x ]
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
Type Enum coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err4.catala_en:5.25-5.38:
|
||||
└─┐
|
||||
5 │ definition z equals [ Int content x ]
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
|
||||
Type Structure coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:14.31-14.40:
|
||||
└──┐
|
||||
14 │ output z content collection Structure
|
||||
│ ‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,9 +12,10 @@ scope S:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ Structure
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ integer
|
||||
└─⯈ Structure
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err5.catala_en:8.5-8.9:
|
||||
@ -22,19 +23,16 @@ Error coming from typechecking the following expression:
|
||||
8 │ 1040
|
||||
│ ‾‾‾‾
|
||||
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err5.catala_en:8.5-8.9:
|
||||
└─┐
|
||||
8 │ 1040
|
||||
│ ‾‾‾‾
|
||||
|
||||
|
||||
Type Structure coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err5.catala_en:6.5-6.46:
|
||||
└─┐
|
||||
6 │ Structure { -- i: 3 -- e: Int content x };
|
||||
│ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -28,9 +28,10 @@ Should be "catala Typecheck", see test err3
|
||||
|
||||
```catala-test-inline
|
||||
$ catala ocaml
|
||||
[ERROR] Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ integer
|
||||
[ERROR]
|
||||
Error during typechecking, incompatible types:
|
||||
┌─⯈ decimal
|
||||
└─⯈ integer
|
||||
|
||||
Error coming from typechecking the following expression:
|
||||
┌─⯈ tests/test_typing/bad/err6.catala_en:20.27-20.30:
|
||||
@ -38,19 +39,16 @@ Error coming from typechecking the following expression:
|
||||
20 │ definition sub.x equals 44.
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type decimal coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/err6.catala_en:20.27-20.30:
|
||||
└──┐
|
||||
20 │ definition sub.x equals 44.
|
||||
│ ‾‾‾
|
||||
|
||||
|
||||
Type integer coming from expression:
|
||||
┌─⯈ tests/test_typing/bad/common.catala_en:12.19-12.26:
|
||||
└──┐
|
||||
12 │ input x content integer
|
||||
│ ‾‾‾‾‾‾‾
|
||||
|
||||
#return code 123#
|
||||
```
|
||||
|
@ -12,7 +12,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] This definition does not indicate which state has to be considered for variable foo.
|
||||
[ERROR]
|
||||
This definition does not indicate which state has to be considered for variable foo.
|
||||
|
||||
┌─⯈ tests/test_variable_state/bad/def_no_state.catala_en:10.14-10.17:
|
||||
└──┐
|
||||
|
@ -12,7 +12,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] There are two states with the same name for the same variable: this is ambiguous. Please change the name of either states.
|
||||
[ERROR]
|
||||
There are two states with the same name for the same variable: this is ambiguous. Please change the name of either states.
|
||||
|
||||
First instance of state "bar":
|
||||
┌─⯈ tests/test_variable_state/bad/double_same_state.catala_en:6.11-6.14:
|
||||
|
@ -16,7 +16,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Unknown label for the scope variable foo.baz: "thing"
|
||||
[ERROR]
|
||||
Unknown label for the scope variable foo.baz: "thing"
|
||||
|
||||
┌─⯈ tests/test_variable_state/bad/no_cross_exceptions.catala_en:14.13-14.18:
|
||||
└──┐
|
||||
|
@ -14,7 +14,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] It is impossible to refer to the variable you are defining when defining its first state.
|
||||
[ERROR]
|
||||
It is impossible to refer to the variable you are defining when defining its first state.
|
||||
|
||||
┌─⯈ tests/test_variable_state/bad/self_reference_first_state.catala_en:10.35-10.38:
|
||||
└──┐
|
||||
|
@ -21,8 +21,9 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] Cyclic dependency detected between the following variables of scope A:
|
||||
foofoo@bar → foofoo@baz → foo@bar → foo@baz → foofoo@bar
|
||||
[ERROR]
|
||||
Cyclic dependency detected between the following variables of scope A:
|
||||
foofoo@bar → foofoo@baz → foo@bar → foo@baz → foofoo@bar
|
||||
|
||||
foofoo@bar is used here in the definition of foofoo@baz:
|
||||
┌─⯈ tests/test_variable_state/bad/state_cycle.catala_en:19.38-19.44:
|
||||
|
@ -14,7 +14,8 @@ scope A:
|
||||
|
||||
```catala-test-inline
|
||||
$ catala Typecheck
|
||||
[ERROR] This identifier is not a state declared for variable foo.
|
||||
[ERROR]
|
||||
This identifier is not a state declared for variable foo.
|
||||
|
||||
┌─⯈ tests/test_variable_state/bad/unknown_state.catala_en:12.24-12.28:
|
||||
└──┐
|
||||
|
Loading…
Reference in New Issue
Block a user