Show 'deepest' location for errors
This commit is contained in:
parent
dff0367a56
commit
e73c901135
@ -20,6 +20,6 @@ let%expect_test _ =
|
||||
[%expect {| ligo: in file "error_typer_6.mligo", line 1, characters 30-64. different type constructors: Expected these two constant type constructors to be the same, but they're different {"a":"string","b":"bool"} |} ] ;
|
||||
|
||||
run_ligo_bad [ "compile-contract" ; "../../test/contracts/negative/error_typer_7.mligo" ; "main" ] ;
|
||||
[%expect {| ligo: in file "error_typer_7.mligo", line 4, characters 17-56. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[b -> string , a -> int]","b":"record[c -> bool , b -> string , a -> int]"} |} ] ;
|
||||
[%expect {| ligo: in file "error_typer_7.mligo", line 4, characters 18-48. records have different sizes: Expected these two types to be the same, but they're different (both are records, but with a different number of arguments) {"a":"record[b -> string , a -> int]","b":"record[c -> bool , b -> string , a -> int]"} |} ] ;
|
||||
|
||||
|
||||
|
@ -34,12 +34,12 @@ let rec error_pp ?(dev = false) out (e : error) =
|
||||
| x -> [ x ] in
|
||||
let location =
|
||||
let opt = e |> member "data" |> member "location" |> string in
|
||||
let aux prec cur =
|
||||
let aux cur prec =
|
||||
match prec with
|
||||
| None -> cur |> member "data" |> member "location" |> string
|
||||
| Some s -> Some s
|
||||
in
|
||||
match List.fold_left aux opt infos with
|
||||
match List.fold_right aux infos opt with
|
||||
| None -> ""
|
||||
| Some s -> s ^ ". "
|
||||
in
|
||||
|
Loading…
Reference in New Issue
Block a user