diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index 1db77eb..6c02c2b 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -19,32 +19,15 @@ %% Newly exported -export([ infer_const/2 ]). --export_type([ utype/0 - , typesig/0 +-export_type([ typesig/0 ]). -include("aeso_utils.hrl"). -type env() :: aeso_tc_env:env(). --type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()] | var_args, utype()} - | {app_t, aeso_syntax:ann(), utype(), [utype()]} - | {tuple_t, aeso_syntax:ann(), [utype()]} - | aeso_syntax:id() | aeso_syntax:qid() - | aeso_syntax:con() | aeso_syntax:qcon() %% contracts - | aeso_syntax:tvar() - | {if_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), utype()} %% Can branch on named argument (protected) - | uvar(). - --type uvar() :: {uvar, aeso_syntax:ann(), reference()}. - --type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}]. - -type type() :: aeso_syntax:type(). -type name() :: string(). --type typesig() :: {type_sig, aeso_syntax:ann(), type_constraints(), [aeso_syntax:named_arg_t()], [type()], type()}. - --type type_constraints() :: none | bytes_concat | bytes_split | address_to_contract | bytecode_hash. -type variance() :: invariant | covariant | contravariant | bivariant. @@ -52,6 +35,12 @@ when_option(pp_types, fun () -> io:format(Fmt, Args) end)). -define(CONSTRUCTOR_MOCK_NAME, "#__constructor__#"). +%% -- Duplicated types ------------------------------------------------------- + +-type utype() :: aeso_tc_typedefs:utype(). +-type named_args_t() :: aeso_tc_typedefs:named_args_t(). +-type typesig() :: aeso_tc_typedefs:typesig(). + %% -- Moved functions -------------------------------------------------------- name(A) -> aeso_tc_name_manip:name(A). diff --git a/src/aeso_tc_constraints.erl b/src/aeso_tc_constraints.erl index b1b0c62..01631d7 100644 --- a/src/aeso_tc_constraints.erl +++ b/src/aeso_tc_constraints.erl @@ -19,7 +19,7 @@ -type uvar() :: {uvar, aeso_syntax:ann(), reference()}. -type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}]. --type utype() :: aeso_ast_infer_types:utype(). +-type utype() :: aeso_tc_typedefs:utype(). %% -- Duplicated macros ------------------------------------------------------ diff --git a/src/aeso_tc_env.erl b/src/aeso_tc_env.erl index d8b27b4..03174a2 100644 --- a/src/aeso_tc_env.erl +++ b/src/aeso_tc_env.erl @@ -135,8 +135,8 @@ infer_const(A, B) -> aeso_ast_infer_types:infer_const(A, B). -type name() :: string(). -type qname() :: [string()]. -type type() :: aeso_syntax:type(). --type utype() :: aeso_ast_infer_types:utype(). --type typesig() :: aeso_ast_infer_types:typesig(). +-type utype() :: aeso_tc_typedefs:utype(). +-type typesig() :: aeso_tc_typedefs:typesig(). %% -- Duplicated macros ------------------------------------------------------ diff --git a/src/aeso_tc_typedefs.erl b/src/aeso_tc_typedefs.erl new file mode 100644 index 0000000..a16bc30 --- /dev/null +++ b/src/aeso_tc_typedefs.erl @@ -0,0 +1,20 @@ +-module(aeso_tc_typedefs). + +-export_type([utype/0, named_args_t/0, typesig/0]). + +-type uvar() :: {uvar, aeso_syntax:ann(), reference()}. + +-type named_args_t() :: uvar() | [{named_arg_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), aeso_syntax:expr()}]. + +-type utype() :: {fun_t, aeso_syntax:ann(), named_args_t(), [utype()] | var_args, utype()} + | {app_t, aeso_syntax:ann(), utype(), [utype()]} + | {tuple_t, aeso_syntax:ann(), [utype()]} + | aeso_syntax:id() | aeso_syntax:qid() + | aeso_syntax:con() | aeso_syntax:qcon() %% contracts + | aeso_syntax:tvar() + | {if_t, aeso_syntax:ann(), aeso_syntax:id(), utype(), utype()} %% Can branch on named argument (protected) + | uvar(). + +-type type_constraints() :: none | bytes_concat | bytes_split | address_to_contract | bytecode_hash. + +-type typesig() :: {type_sig, aeso_syntax:ann(), type_constraints(), [aeso_syntax:named_arg_t()], [aeso_syntax:type()], aeso_syntax:type()}.