From d083add61fcbbfb5b75869dcb0348ad52c8fee2c Mon Sep 17 00:00:00 2001 From: Benjamin Canou Date: Sat, 22 Jul 2017 00:09:22 +0200 Subject: [PATCH] Michelson: pretty print typechecking errors when using run program --- src/client/embedded/alpha/client_proto_programs.ml | 4 ++-- src/proto/alpha/script_interpreter.ml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/embedded/alpha/client_proto_programs.ml b/src/client/embedded/alpha/client_proto_programs.ml index 3bf6e586e..3338ae1b6 100644 --- a/src/client/embedded/alpha/client_proto_programs.ml +++ b/src/client/embedded/alpha/client_proto_programs.ml @@ -607,7 +607,7 @@ let commands () = trace >>= fun () -> return () | Error errs -> - cctxt.warning "%a" pp_print_error errs >>= fun () -> + report_typechecking_errors cctxt errs >>= fun () -> cctxt.error "error running program" >>= fun () -> return () else @@ -619,7 +619,7 @@ let commands () = (print_expr no_locations) output >>= fun () -> return () | Error errs -> - cctxt.warning "%a" pp_print_error errs >>= fun () -> + report_typechecking_errors cctxt errs >>= fun () -> cctxt.error "error running program" >>= fun () -> return ()) ; diff --git a/src/proto/alpha/script_interpreter.ml b/src/proto/alpha/script_interpreter.ml index 762d80bfb..9464c37fa 100644 --- a/src/proto/alpha/script_interpreter.ml +++ b/src/proto/alpha/script_interpreter.ml @@ -515,7 +515,9 @@ and execute ?log origination orig source ctxt storage script amount arg qta = (Lwt.return (parse_ty storage_type)) >>=? fun (Ex_ty storage_type) -> let arg_type_full = Pair_t (Pair_t (Tez_t, arg_type), storage_type) in let ret_type_full = Pair_t (ret_type, storage_type) in - parse_lambda ~storage_type ctxt arg_type_full ret_type_full code >>=? fun lambda -> + trace + (Ill_typed_contract (code, arg_type, ret_type, storage_type, [])) + (parse_lambda ~storage_type ctxt arg_type_full ret_type_full code) >>=? fun lambda -> parse_data ctxt arg_type arg >>=? fun arg -> parse_data ctxt storage_type storage >>=? fun storage -> interp ?log origination qta orig source amount ctxt lambda ((amount, arg), storage)