From ef05b47dc6c90337609d87083034e4fee60ce6ba Mon Sep 17 00:00:00 2001 From: Tom Jack Date: Fri, 25 Oct 2019 11:27:55 -0500 Subject: [PATCH] Typecheck address argument to get_contract --- src/passes/operators/operators.ml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 8a24cbe1f..ab4527bdc 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -398,7 +398,10 @@ module Typer = struct let%bind () = assert_eq_1 op_lst (t_list (t_operation ()) ()) in 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 = trace_option (simple_error "get_contract needs a type annotation") tv_opt in let%bind tv' =