Skip to content

Commit a32fb8c

Browse files
the-mikedavisdcorbacho
authored andcommitted
Fix dialyzer error for amqqueue ETS match patterns
1 parent 9e42d58 commit a32fb8c

File tree

1 file changed

+58
-48
lines changed

1 file changed

+58
-48
lines changed

deps/rabbit/src/amqqueue.erl

Lines changed: 58 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,41 @@
8888
(T =:= classic orelse T =:= ?amqqueue_v1_type)).
8989

9090
-record(amqqueue, {
91-
name :: rabbit_amqqueue:name() | '_', %% immutable
92-
durable :: boolean() | '_', %% immutable
93-
auto_delete :: boolean() | '_', %% immutable
94-
exclusive_owner = none :: pid() | none | '_', %% immutable
95-
arguments = [] :: rabbit_framing:amqp_table() | '_', %% immutable
96-
pid :: pid() | ra_server_id() | none | '_', %% durable (just so we
97-
%% know home node)
98-
slave_pids = [] :: [pid()] | none | '_', %% transient
99-
sync_slave_pids = [] :: [pid()] | none| '_',%% transient
100-
recoverable_slaves = [] :: [atom()] | none | '_', %% durable
101-
policy :: proplists:proplist() |
102-
none | undefined | '_', %% durable, implicit update as
103-
%% above
104-
operator_policy :: proplists:proplist() |
105-
none | undefined | '_', %% durable, implicit
106-
%% update as above
107-
gm_pids = [] :: [{pid(), pid()}] | none | '_', %% transient
108-
decorators :: [atom()] | none | undefined | '_', %% transient,
109-
%% recalculated
110-
%% as above
111-
state = live :: atom() | none | '_', %% durable (have we crashed?)
112-
policy_version = 0 :: non_neg_integer() | '_',
113-
slave_pids_pending_shutdown = [] :: [pid()] | '_',
114-
vhost :: rabbit_types:vhost() | undefined | '_', %% secondary index
115-
options = #{} :: map() | '_',
116-
type = ?amqqueue_v1_type :: module() | '_',
117-
type_state = #{} :: map() | '_'
91+
%% immutable
92+
name :: rabbit_amqqueue:name() | ets:match_pattern(),
93+
%% immutable
94+
durable :: boolean() | ets:match_pattern(),
95+
%% immutable
96+
auto_delete :: boolean() | ets:match_pattern(),
97+
%% immutable
98+
exclusive_owner = none :: pid() | none | ets:match_pattern(),
99+
%% immutable
100+
arguments = [] :: rabbit_framing:amqp_table() | ets:match_pattern(),
101+
%% durable (just so we know home node)
102+
pid :: pid() | ra_server_id() | none | ets:match_pattern(),
103+
%% transient
104+
slave_pids = [] :: [pid()] | none | ets:match_pattern(),
105+
%% transient
106+
sync_slave_pids = [] :: [pid()] | none| ets:match_pattern(),
107+
%% durable
108+
recoverable_slaves = [] :: [atom()] | none | ets:match_pattern(),
109+
%% durable, implicit update as above
110+
policy :: binary() | none | undefined | ets:match_pattern(),
111+
%% durable, implicit update as above
112+
operator_policy :: binary() | none | undefined | ets:match_pattern(),
113+
%% transient
114+
gm_pids = [] :: [{pid(), pid()}] | none | ets:match_pattern(),
115+
%% transient, recalculated as above
116+
decorators :: [atom()] | none | undefined | ets:match_pattern(),
117+
%% durable (have we crashed?)
118+
state = live :: atom() | none | ets:match_pattern(),
119+
policy_version = 0 :: non_neg_integer() | ets:match_pattern(),
120+
slave_pids_pending_shutdown = [] :: [pid()] | ets:match_pattern(),
121+
%% secondary index
122+
vhost :: rabbit_types:vhost() | undefined | ets:match_pattern(),
123+
options = #{} :: map() | ets:match_pattern(),
124+
type = ?amqqueue_v1_type :: module() | ets:match_pattern(),
125+
type_state = #{} :: map() | ets:match_pattern()
118126
}).
119127

120128
-type amqqueue() :: amqqueue_v2().
@@ -146,26 +154,26 @@
146154

147155
-type amqqueue_pattern() :: amqqueue_v2_pattern().
148156
-type amqqueue_v2_pattern() :: #amqqueue{
149-
name :: rabbit_amqqueue:name() | '_',
150-
durable :: '_',
151-
auto_delete :: '_',
152-
exclusive_owner :: '_',
153-
arguments :: '_',
154-
pid :: '_',
155-
slave_pids :: '_',
156-
sync_slave_pids :: '_',
157-
recoverable_slaves :: '_',
158-
policy :: '_',
159-
operator_policy :: '_',
160-
gm_pids :: '_',
161-
decorators :: '_',
162-
state :: '_',
163-
policy_version :: '_',
164-
slave_pids_pending_shutdown :: '_',
165-
vhost :: '_',
166-
options :: '_',
167-
type :: atom() | '_',
168-
type_state :: '_'
157+
name :: rabbit_amqqueue:name() | ets:match_pattern(),
158+
durable :: ets:match_pattern(),
159+
auto_delete :: ets:match_pattern(),
160+
exclusive_owner :: ets:match_pattern(),
161+
arguments :: ets:match_pattern(),
162+
pid :: ets:match_pattern(),
163+
slave_pids :: ets:match_pattern(),
164+
sync_slave_pids :: ets:match_pattern(),
165+
recoverable_slaves :: ets:match_pattern(),
166+
policy :: ets:match_pattern(),
167+
operator_policy :: ets:match_pattern(),
168+
gm_pids :: ets:match_pattern(),
169+
decorators :: ets:match_pattern(),
170+
state :: ets:match_pattern(),
171+
policy_version :: ets:match_pattern(),
172+
slave_pids_pending_shutdown :: ets:match_pattern(),
173+
vhost :: ets:match_pattern(),
174+
options :: ets:match_pattern(),
175+
type :: atom() | ets:match_pattern(),
176+
type_state :: ets:match_pattern()
169177
}.
170178

171179
-export_type([amqqueue/0,
@@ -570,7 +578,9 @@ field_vhost() ->
570578
pattern_match_all() ->
571579
#amqqueue{_ = '_'}.
572580

573-
-spec pattern_match_on_name(rabbit_amqqueue:name()) -> amqqueue_pattern().
581+
-spec pattern_match_on_name(Name) -> Pattern when
582+
Name :: rabbit_amqqueue:name() | ets:match_pattern(),
583+
Pattern :: amqqueue_pattern().
574584

575585
pattern_match_on_name(Name) ->
576586
#amqqueue{name = Name, _ = '_'}.

0 commit comments

Comments
 (0)