From 3a7c8f905a6e9e0f9b416e48b175f17f8c888e39 Mon Sep 17 00:00:00 2001 From: Ulf Norell Date: Mon, 28 Jan 2019 14:54:34 +0100 Subject: [PATCH] Fix incorrect type specs h/t OTP-21 dialyzer --- src/aeso_abi.erl | 10 +++++----- src/aeso_compiler.erl | 2 +- src/aeso_pretty.erl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/aeso_abi.erl b/src/aeso_abi.erl index ff767ea..c9f32ba 100644 --- a/src/aeso_abi.erl +++ b/src/aeso_abi.erl @@ -27,8 +27,8 @@ -type typerep() :: aeso_sophia:type(). -type function_type_info() :: { FunctionHash :: hash() , FunctionName :: function_name() - , ArgType :: aeso_sophia:heap() %% binary typerep - , OutType :: aeso_sophia:heap() %% binary typerep + , ArgType :: binary() %% binary typerep + , OutType :: binary() %% binary typerep }. -type type_info() :: [function_type_info()]. @@ -84,8 +84,8 @@ check_given_type(FunName, GivenArgs, GivenRet, CalldataType, ExpectRet) -> {expected, ExpectArgs, '=>', ExpectRet}}} end. --spec check_calldata(aeso_sophia:heap(), type_info()) -> - {'ok', typerep()} | {'error', atom()}. +-spec check_calldata(binary(), type_info()) -> + {'ok', typerep(), typerep()} | {'error', atom()}. check_calldata(CallData, TypeInfo) -> %% The first element of the CallData should be the function name case get_function_hash_from_calldata(CallData) of @@ -153,7 +153,7 @@ arg_typerep_from_function(Function, TypeInfo) -> end. -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) -> case lists:keyfind(TypeHash, 1, TypeInfo) of {TypeHash,_Function, ArgTypeBin, OutTypeBin} -> diff --git a/src/aeso_compiler.erl b/src/aeso_compiler.erl index 8d270e6..c41b09c 100644 --- a/src/aeso_compiler.erl +++ b/src/aeso_compiler.erl @@ -131,7 +131,7 @@ check_call(ContractString, Options) -> end. -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}. create_calldata(Contract, "", CallCode) when is_map(Contract) -> case check_call(CallCode, []) of diff --git a/src/aeso_pretty.erl b/src/aeso_pretty.erl index f9209dd..ac073c1 100644 --- a/src/aeso_pretty.erl +++ b/src/aeso_pretty.erl @@ -170,7 +170,7 @@ expr(E) -> expr_p(0, E). %% -- 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({con, _, Name}) -> text(Name); name({qid, _, Names}) -> text(string:join(Names, "."));