Fix dialyzer issues

This commit is contained in:
Gaith Hallak 2022-10-13 11:28:44 +03:00
parent ebd72d9203
commit 49200a6c55
2 changed files with 8 additions and 8 deletions

View File

@ -1487,7 +1487,7 @@ check_reserved_entrypoints(Funs) ->
check_fundecl(Env, {fun_decl, Ann, Id = {id, _, Name}, Type = {fun_t, _, _, _, _}}) -> check_fundecl(Env, {fun_decl, Ann, Id = {id, _, Name}, Type = {fun_t, _, _, _, _}}) ->
Type1 = {fun_t, _, Named, Args, Ret} = check_type(Env, Type), Type1 = {fun_t, _, Named, Args, Ret} = check_type(Env, Type),
TypeSig = {type_sig, Ann, none, Named, Args, Ret}, TypeSig = {type_sig, Ann, none, Named, Args, Ret},
register_implementation(Env, Name), register_implementation(Name),
{{Name, TypeSig}, {fun_decl, Ann, Id, Type1}}; {{Name, TypeSig}, {fun_decl, Ann, Id, Type1}};
check_fundecl(Env, {fun_decl, Ann, Id = {id, _, Name}, Type}) -> check_fundecl(Env, {fun_decl, Ann, Id = {id, _, Name}, Type}) ->
type_error({fundecl_must_have_funtype, Ann, Id, Type}), type_error({fundecl_must_have_funtype, Ann, Id, Type}),
@ -1495,11 +1495,11 @@ check_fundecl(Env, {fun_decl, Ann, Id = {id, _, Name}, Type}) ->
%% Register the function FunName as implemented by deleting it from the functions %% Register the function FunName as implemented by deleting it from the functions
%% to be implemented table if it is included there, or return true otherwise. %% to be implemented table if it is included there, or return true otherwise.
-spec register_implementation(env(), FunName) -> true | no_return() when -spec register_implementation(FunName) -> true | no_return() when
FunName :: string(). FunName :: string().
register_implementation(Env, Name) -> register_implementation(Name) ->
case ets_lookup(functions_to_implement, Name) of case ets_lookup(functions_to_implement, Name) of
[{Name, _, {fun_decl, _, _, DeclType}}] -> [{Name, _, {fun_decl, _, _, _}}] ->
ets_delete(functions_to_implement, Name); ets_delete(functions_to_implement, Name);
[] -> [] ->
true; true;
@ -1509,9 +1509,9 @@ register_implementation(Env, Name) ->
infer_nonrec(Env, LetFun) -> infer_nonrec(Env, LetFun) ->
create_constraints(), create_constraints(),
NewLetFun = {{FunName, FunSig}, _} = infer_letfun(Env, LetFun), NewLetFun = {{FunName, _}, _} = infer_letfun(Env, LetFun),
check_special_funs(Env, NewLetFun), check_special_funs(Env, NewLetFun),
register_implementation(Env, FunName), register_implementation(FunName),
solve_then_destroy_and_report_unsolved_constraints(Env), solve_then_destroy_and_report_unsolved_constraints(Env),
Result = {TypeSig, _} = instantiate(NewLetFun), Result = {TypeSig, _} = instantiate(NewLetFun),
print_typesig(TypeSig), print_typesig(TypeSig),
@ -1541,7 +1541,7 @@ infer_letrec(Env, Defs) ->
Inferred = Inferred =
[ begin [ begin
Res = {{Name, TypeSig}, _} = infer_letfun(ExtendEnv, LF), Res = {{Name, TypeSig}, _} = infer_letfun(ExtendEnv, LF),
register_implementation(Env, Name), register_implementation(Name),
Got = proplists:get_value(Name, Funs), Got = proplists:get_value(Name, Funs),
Expect = typesig_to_fun_t(TypeSig), Expect = typesig_to_fun_t(TypeSig),
unify(Env, Got, Expect, {check_typesig, Name, Got, Expect}), unify(Env, Got, Expect, {check_typesig, Name, Got, Expect}),

View File

@ -213,7 +213,7 @@ serialize_contract_code(Env, C) ->
none -> none ->
Options = Env#env.options, Options = Env#env.options,
FCode = maps:get(C, Env#env.child_contracts), FCode = maps:get(C, Env#env.child_contracts),
FateCode = compile(Env#env.child_contracts, FCode, Options), {FateCode, _} = compile(Env#env.child_contracts, FCode, Options),
ByteCode = aeb_fate_code:serialize(FateCode, []), ByteCode = aeb_fate_code:serialize(FateCode, []),
{ok, Version} = aeso_compiler:version(), {ok, Version} = aeso_compiler:version(),
OriginalSourceCode = proplists:get_value(original_src, Options, ""), OriginalSourceCode = proplists:get_value(original_src, Options, ""),