More space between multiple errors, no numbers if just one

This commit is contained in:
Louis Gesbert 2024-06-20 10:52:57 +02:00
parent a7094fe52d
commit ad15984d0b
4 changed files with 15 additions and 8 deletions

View File

@ -326,10 +326,14 @@ module Content = struct
ppf content;
Format.pp_print_newline ppf ()
let emit_n (target : level) (contents : t list) : unit =
let emit_n (target : level) = function
| [content] -> emit content target
| contents ->
let ppf = get_ppf target in
let len = List.length contents in
List.iteri
(fun i c ->
if i > 0 then Format.pp_print_newline ppf ();
let extra_label = Printf.sprintf "(%d/%d)" (succ i) len in
let pp_marker ?extra_label:_ = pp_marker ~extra_label in
emit ~pp_marker c target)

View File

@ -29,6 +29,7 @@ $ catala Typecheck
│ 8 │ definition test_var equals 10 xor 20
│ │ ‾‾‾
└─ 'xor' should be a boolean operator
┌─[ERROR (2/2)]─
│ Error during typechecking, incompatible types:

View File

@ -32,6 +32,7 @@ $ catala test-scope A
│ Maybe you wanted to write : "definition" ?
└─
┌─[ERROR (2/2)]─
│ Syntax error at "equal":

View File

@ -30,6 +30,7 @@ $ catala Typecheck
│ 8 │ data i content integer
│ │ ‾‾‾‾‾‾‾
└─
┌─[ERROR (2/2)]─
│ Error during typechecking, incompatible types: