summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hood <0x6e6562@gmail.com>2008-09-27 21:11:02 +0100
committerBen Hood <0x6e6562@gmail.com>2008-09-27 21:11:02 +0100
commit87396f8ddb979038e0173bd8fb10977558a7e476 (patch)
treedcad36df1c08354b9bfe8d61b8ef709f5abe5132
parent9bd58e8226bd00ab6b5ac774ba88fbe3d3ab53b5 (diff)
downloadrabbitmq-server-git-87396f8ddb979038e0173bd8fb10977558a7e476.tar.gz
Dialyzer fixes
-rw-r--r--include/rabbit.hrl5
-rw-r--r--src/rabbit_misc.erl6
2 files changed, 8 insertions, 3 deletions
diff --git a/include/rabbit.hrl b/include/rabbit.hrl
index 0ab51b363e..4189d20f32 100644
--- a/include/rabbit.hrl
+++ b/include/rabbit.hrl
@@ -70,6 +70,7 @@
-type(node() :: atom()).
-type(socket() :: port()).
-type(thunk(T) :: fun(() -> T)).
+-type(function(T) :: fun((T) -> T)).
%% this is really an abstract type, but dialyzer does not support them
-type(guid() :: any()).
@@ -84,6 +85,10 @@
-type(user() ::
#user{username :: username(),
password :: password()}).
+-type(resource() ::
+ #resource{virtual_host :: vhost(),
+ kind :: 'queue' | 'exchange',
+ name :: resource_name()}).
-type(amqqueue() ::
#amqqueue{name :: queue_name(),
durable :: bool(),
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 2975cc4df7..f9ee494aa4 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -68,7 +68,7 @@
-spec(get_config/2 :: (atom(), A) -> A).
-spec(set_config/2 :: (atom(), any()) -> 'ok').
-spec(dirty_read/1 :: ({atom(), any()}) -> {'ok', any()} | not_found()).
--spec(r/3 :: (vhost(), K, resource_name()) -> r(K) when is_subtype(K, atom())).
+-spec(r/3 :: (vhost() | resource(), K, resource_name()) -> r(K) when is_subtype(K, atom())).
-spec(r/2 :: (vhost(), K) -> #resource{virtual_host :: vhost(),
kind :: K,
name :: '_'}
@@ -80,8 +80,8 @@
-spec(with_user/2 :: (username(), thunk(A)) -> A).
-spec(with_vhost/2 :: (vhost(), thunk(A)) -> A).
-spec(with_user_and_vhost/3 :: (username(), vhost(), thunk(A)) -> A).
--spec(execute_mnesia_transaction/1 :: (thunk(A)) -> A).
--spec(execute_mnesia_transaction/2 :: (thunk(A), list()) -> A).
+-spec(execute_mnesia_transaction/1 :: (thunk(A) | function(A)) -> A).
+-spec(execute_mnesia_transaction/2 :: (thunk(A) | function(A), list()) -> A).
-spec(ensure_ok/2 :: ('ok' | {'error', any()}, atom()) -> 'ok').
-spec(localnode/1 :: (atom()) -> node()).
-spec(tcp_name/3 :: (atom(), ip_address(), ip_port()) -> atom()).