Fix incorrect type specs #510
@ -27,8 +27,8 @@
|
|||||||
-type typerep() :: aeso_sophia:type().
|
-type typerep() :: aeso_sophia:type().
|
||||||
-type function_type_info() :: { FunctionHash :: hash()
|
-type function_type_info() :: { FunctionHash :: hash()
|
||||||
, FunctionName :: function_name()
|
, FunctionName :: function_name()
|
||||||
, ArgType :: aeso_sophia:heap() %% binary typerep
|
, ArgType :: binary() %% binary typerep
|
||||||
, OutType :: aeso_sophia:heap() %% binary typerep
|
, OutType :: binary() %% binary typerep
|
||||||
}.
|
}.
|
||||||
-type type_info() :: [function_type_info()].
|
-type type_info() :: [function_type_info()].
|
||||||
|
|
||||||
@ -84,8 +84,8 @@ check_given_type(FunName, GivenArgs, GivenRet, CalldataType, ExpectRet) ->
|
|||||||
{expected, ExpectArgs, '=>', ExpectRet}}}
|
{expected, ExpectArgs, '=>', ExpectRet}}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec check_calldata(aeso_sophia:heap(), type_info()) ->
|
-spec check_calldata(binary(), type_info()) ->
|
||||||
{'ok', typerep()} | {'error', atom()}.
|
{'ok', typerep(), typerep()} | {'error', atom()}.
|
||||||
check_calldata(CallData, TypeInfo) ->
|
check_calldata(CallData, TypeInfo) ->
|
||||||
%% The first element of the CallData should be the function name
|
%% The first element of the CallData should be the function name
|
||||||
case get_function_hash_from_calldata(CallData) of
|
case get_function_hash_from_calldata(CallData) of
|
||||||
@ -153,7 +153,7 @@ arg_typerep_from_function(Function, TypeInfo) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-spec typereps_from_type_hash(hash(), type_info()) ->
|
-spec typereps_from_type_hash(hash(), type_info()) ->
|
||||||
{'ok', typerep()} | {'error', 'bad_type_data' | 'unknown_function'}.
|
{'ok', typerep(), typerep()} | {'error', 'bad_type_data' | 'unknown_function'}.
|
||||||
typereps_from_type_hash(TypeHash, TypeInfo) ->
|
typereps_from_type_hash(TypeHash, TypeInfo) ->
|
||||||
case lists:keyfind(TypeHash, 1, TypeInfo) of
|
case lists:keyfind(TypeHash, 1, TypeInfo) of
|
||||||
{TypeHash,_Function, ArgTypeBin, OutTypeBin} ->
|
{TypeHash,_Function, ArgTypeBin, OutTypeBin} ->
|
||||||
|
@ -131,7 +131,7 @@ check_call(ContractString, Options) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
-spec create_calldata(map(), string(), string()) ->
|
-spec create_calldata(map(), string(), string()) ->
|
||||||
{ok, aeso_sophia:heap(), aeso_sophia:type(), aeso_sophia:type()}
|
{ok, binary(), aeso_sophia:type(), aeso_sophia:type()}
|
||||||
| {error, argument_syntax_error}.
|
| {error, argument_syntax_error}.
|
||||||
create_calldata(Contract, "", CallCode) when is_map(Contract) ->
|
create_calldata(Contract, "", CallCode) when is_map(Contract) ->
|
||||||
case check_call(CallCode, []) of
|
case check_call(CallCode, []) of
|
||||||
|
@ -170,7 +170,7 @@ expr(E) -> expr_p(0, E).
|
|||||||
|
|
||||||
%% -- Not exported -----------------------------------------------------------
|
%% -- Not exported -----------------------------------------------------------
|
||||||
|
|
||||||
-spec name(aeso_syntax:id() | aeso_syntax:con() | aeso_syntax:tvar()) -> doc().
|
-spec name(aeso_syntax:id() | aeso_syntax:qid() | aeso_syntax:con() | aeso_syntax:qcon() | aeso_syntax:tvar()) -> doc().
|
||||||
name({id, _, Name}) -> text(Name);
|
name({id, _, Name}) -> text(Name);
|
||||||
name({con, _, Name}) -> text(Name);
|
name({con, _, Name}) -> text(Name);
|
||||||
name({qid, _, Names}) -> text(string:join(Names, "."));
|
name({qid, _, Names}) -> text(string:join(Names, "."));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user