From 72aabf1f4980ce3bad59eb672c6f5a3684230a8d Mon Sep 17 00:00:00 2001 From: Galfour Date: Wed, 8 May 2019 13:50:41 +0000 Subject: [PATCH] add cast from string to address --- src/ligo/typer/typer.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ligo/typer/typer.ml b/src/ligo/typer/typer.ml index 7936b166f..23ca942ce 100644 --- a/src/ligo/typer/typer.ml +++ b/src/ligo/typer/typer.ml @@ -356,8 +356,11 @@ and type_annotated_expression : environment -> I.annotated_expression -> O.annot return (E_literal (Literal_bool b)) (t_bool ()) | E_literal Literal_unit -> return (E_literal (Literal_unit)) (t_unit ()) - | E_literal (Literal_string s) -> - return (E_literal (Literal_string s)) (t_string ()) + | E_literal (Literal_string s) -> ( + match Option.map ~f:Ast_typed.get_type' tv_opt with + | Some (T_constant ("address" , [])) -> return (E_literal (Literal_address s)) (t_string ()) + | _ -> return (E_literal (Literal_string s)) (t_string ()) + ) | E_literal (Literal_bytes s) -> return (E_literal (Literal_bytes s)) (t_bytes ()) | E_literal (Literal_int n) ->