Merge pull request #8359 from ieQu1/bpapi-fix-check

fix(bpapi): Don't check forward compatibility from old release
This commit is contained in:
ieQu1 2022-06-30 14:56:29 +02:00 committed by GitHub
commit 3df86508bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -106,9 +106,10 @@ check_compat(DumpFilenames) ->
%% Note: sets nok flag
-spec check_compat(fulldump(), fulldump()) -> ok.
check_compat(Dump1, Dump2) ->
check_compat(Dump1 = #{release := Rel1}, Dump2 = #{release := Rel2}) ->
check_api_immutability(Dump1, Dump2),
typecheck_apis(Dump1, Dump2).
Rel2 >= Rel1 andalso
typecheck_apis(Dump1, Dump2).
%% It's not allowed to change BPAPI modules. Check that no changes
%% have been made. (sets nok flag)
@ -202,10 +203,15 @@ typecheck_rpc(Caller, Callee) ->
-spec get_param_types(dialyzer_dump(), emqx_bpapi:call()) -> param_types().
get_param_types(Signatures, {M, F, A}) ->
Arity = length(A),
#{{M, F, Arity} := {_RetType, AttrTypes}} = Signatures,
% assert
Arity = length(AttrTypes),
maps:from_list(lists:zip(A, AttrTypes)).
case Signatures of
#{{M, F, Arity} := {_RetType, AttrTypes}} ->
% assert
Arity = length(AttrTypes),
maps:from_list(lists:zip(A, AttrTypes));
_ ->
logger:critical("Call ~p:~p/~p is not found in PLT~n", [M, F, Arity]),
error(badkey)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Functions related to BPAPI dumping