Skip to content

Commit

Permalink
Fix dialyzer
Browse files Browse the repository at this point in the history
Fix dialyzer error:
```
rabbit_channel.erl:309:1: The attempt to match a term of type
          mc:state() against the pattern
          {'basic_message', _, _, _, _, _} breaks the opacity of the term
```
  • Loading branch information
ansd committed Jun 6, 2024
1 parent a3a51f0 commit 3b7c911
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions deps/rabbit/src/rabbit_channel.erl
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,14 @@ send_command(Pid, Msg) ->


-spec deliver_reply(binary(), mc:state()) -> 'ok'.
deliver_reply(RoutingKey, BasicMsg = #basic_message{}) ->
%% 3.12 nodes expect a #delivery{}
deliver_reply(RoutingKey, #delivery{message = BasicMsg});
deliver_reply(<<"amq.rabbitmq.reply-to.", EncodedBin/binary>>, Message) ->
deliver_reply(<<"amq.rabbitmq.reply-to.", EncodedBin/binary>>, Message0) ->
Message = case rabbit_feature_flags:is_enabled(message_containers) of
true ->
Message0;
false ->
%% 3.12 nodes expect a #delivery{}
#delivery{message = Message0}
end,
case rabbit_direct_reply_to:decode_reply_to_v2(EncodedBin,
rabbit_nodes:all_running_with_hashes()) of
{ok, Pid, Key} ->
Expand All @@ -333,8 +337,7 @@ deliver_reply_v1(EncodedBin, Message) ->
%% We want to ensure people can't use this mechanism to send a message
%% to an arbitrary process and kill it!

-spec deliver_reply_local(pid(), binary(), mc:state()) -> 'ok'.

-spec deliver_reply_local(pid(), binary(), mc:state() | rabbit_types:delivery()) -> ok.
deliver_reply_local(Pid, Key, #delivery{message = BasicMsg}) ->
%% Backward compat clause when feature flag message_containers is disabled.
%% 3.12 nodes send us a #delivery{}.
Expand Down

0 comments on commit 3b7c911

Please sign in to comment.