Typecheck address argument to get_contract

This commit is contained in:
Tom Jack 2019-10-25 11:27:55 -05:00
parent d015f60d66
commit ef05b47dc6

View File

@ -398,7 +398,10 @@ module Typer = struct
let%bind () = assert_eq_1 op_lst (t_list (t_operation ()) ()) in let%bind () = assert_eq_1 op_lst (t_list (t_operation ()) ()) in
ok @@ (t_pair (t_operation ()) (t_address ()) ()) ok @@ (t_pair (t_operation ()) (t_address ()) ())
let get_contract = typer_1_opt "CONTRACT" @@ fun _ tv_opt -> let get_contract = typer_1_opt "CONTRACT" @@ fun addr_tv tv_opt ->
if not (type_value_eq (addr_tv, t_address ()))
then fail @@ simple_error (Format.asprintf "get_contract expects an address, got %a" PP.type_value addr_tv)
else
let%bind tv = let%bind tv =
trace_option (simple_error "get_contract needs a type annotation") tv_opt in trace_option (simple_error "get_contract needs a type annotation") tv_opt in
let%bind tv' = let%bind tv' =