Merge branch 'feature/signature_type' into 'dev'

add signature type

See merge request ligolang/ligo!164
This commit is contained in:
Rémi Lesenechal 2019-10-31 16:36:23 +00:00
commit 0423a704ec
4 changed files with 6 additions and 1 deletions

View File

@ -116,6 +116,7 @@ let rec transpile_type (t:AST.type_value) : type_value result =
| T_constant ("timestamp", []) -> ok (T_base Base_timestamp)
| T_constant ("unit", []) -> ok (T_base Base_unit)
| T_constant ("operation", []) -> ok (T_base Base_operation)
| T_constant ("signature", []) -> ok (T_base Base_signature)
| T_constant ("contract", [x]) ->
let%bind x' = transpile_type x in
ok (T_contract x')

View File

@ -68,6 +68,7 @@ module Ty = struct
| Base_timestamp -> return timestamp_k
| Base_bytes -> return bytes_k
| Base_operation -> fail (not_comparable "operation")
| Base_signature -> fail (not_comparable "signature")
let comparable_type : type_value -> ex_comparable_ty result = fun tv ->
match tv with
@ -97,6 +98,7 @@ module Ty = struct
| Base_timestamp -> return timestamp
| Base_bytes -> return bytes
| Base_operation -> return operation
| Base_signature -> return signature
let rec type_ : type_value -> ex_ty result =
function
@ -182,6 +184,7 @@ let base_type : type_base -> O.michelson result =
| Base_timestamp -> ok @@ O.prim T_timestamp
| Base_bytes -> ok @@ O.prim T_bytes
| Base_operation -> ok @@ O.prim T_operation
| Base_signature -> ok @@ O.prim T_signature
let rec type_ : type_value -> O.michelson result =
function

View File

@ -20,6 +20,7 @@ let type_base ppf : type_base -> _ = function
| Base_timestamp -> fprintf ppf "timestamp"
| Base_bytes -> fprintf ppf "bytes"
| Base_operation -> fprintf ppf "operation"
| Base_signature -> fprintf ppf "signature"
let rec type_ ppf : type_value -> _ = function
| T_or(a, b) -> fprintf ppf "(%a) | (%a)" annotated a annotated b

View File

@ -6,7 +6,7 @@ type type_base =
| Base_int | Base_nat | Base_tez
| Base_timestamp
| Base_string | Base_bytes | Base_address
| Base_operation
| Base_operation | Base_signature
type 'a annotated = string option * 'a