Client, Michelson: minor fixes in error reporting
This commit is contained in:
parent
a425b3dc27
commit
ffec060a6f
@ -61,11 +61,9 @@ let expand_all source ast errors =
|
|||||||
let parse_toplevel ?check source =
|
let parse_toplevel ?check source =
|
||||||
let tokens, lexing_errors = Micheline_parser.tokenize source in
|
let tokens, lexing_errors = Micheline_parser.tokenize source in
|
||||||
let asts, parsing_errors = Micheline_parser.parse_toplevel ?check tokens in
|
let asts, parsing_errors = Micheline_parser.parse_toplevel ?check tokens in
|
||||||
let ast = match asts with
|
let ast =
|
||||||
| [ ast ] -> ast
|
let start = min_point asts and stop = max_point asts in
|
||||||
| asts ->
|
Seq ({ start ; stop }, asts, None) in
|
||||||
let start = min_point asts and stop = max_point asts in
|
|
||||||
Seq ({ start ; stop }, asts, None) in
|
|
||||||
expand_all source ast (lexing_errors @ parsing_errors)
|
expand_all source ast (lexing_errors @ parsing_errors)
|
||||||
|
|
||||||
let parse_expression ?check source =
|
let parse_expression ?check source =
|
||||||
|
@ -148,7 +148,7 @@ let commands () =
|
|||||||
~details:(not no_print_source) ~parsed
|
~details:(not no_print_source) ~parsed
|
||||||
~show_source:(not no_print_source)
|
~show_source:(not no_print_source)
|
||||||
ppf errors) () >>= fun () ->
|
ppf errors) () >>= fun () ->
|
||||||
return ()
|
cctxt#error "syntax error in program"
|
||||||
) ;
|
) ;
|
||||||
|
|
||||||
command ~group ~desc: "Ask the node to typecheck a data expression."
|
command ~group ~desc: "Ask the node to typecheck a data expression."
|
||||||
|
@ -2240,6 +2240,7 @@ and parse_contract
|
|||||||
and parse_toplevel
|
and parse_toplevel
|
||||||
: Script.expr -> (Script.node * Script.node * Script.node) tzresult
|
: Script.expr -> (Script.node * Script.node * Script.node) tzresult
|
||||||
= fun toplevel ->
|
= fun toplevel ->
|
||||||
|
record_trace (Ill_typed_contract (toplevel, [])) @@
|
||||||
match root toplevel with
|
match root toplevel with
|
||||||
| Int (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], Int_kind))
|
| Int (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], Int_kind))
|
||||||
| String (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], String_kind))
|
| String (loc, _) -> error (Invalid_kind (loc, [ Seq_kind ], String_kind))
|
||||||
|
Loading…
Reference in New Issue
Block a user