mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Dialyzer dirty workarounds because re:mp() is not an exported type
Since Erlang/OTP 26, Dialyzer by default reports unknown types. ejabberd's type specs refer to the re:mp() type, but that isn't exported in the OTP source code, and cannot be used in any other modules. This commit provides very dirty workarounds, and any cleaner alternative is very welcomed.
This commit is contained in:
parent
1b06f4ca4f
commit
0bbc255814
@ -442,7 +442,9 @@ Makefile: Makefile.in
|
||||
|
||||
ifeq "$(REBAR_VER)" "3"
|
||||
dialyzer:
|
||||
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/re:mp/ tuple/g' {} \;
|
||||
$(REBAR) dialyzer
|
||||
find src/*_opt.erl -type f \! -regex ".*git.*" -exec sed -i 's/ tuple/re:mp/g' {} \;
|
||||
else
|
||||
deps := $(wildcard $(DEPSDIR)/*/ebin)
|
||||
|
||||
|
@ -62,5 +62,7 @@
|
||||
_ -> 'Elixir.Logger':bare_log(error, io_lib:format(Format, Args), [?MODULE])
|
||||
end).
|
||||
|
||||
-type re_mp() :: {re_pattern, _, _, _, _}. % Copied from re.erl
|
||||
|
||||
%% Uncomment if you want to debug p1_fsm/gen_fsm
|
||||
%%-define(DBGFSM, true).
|
||||
|
18
src/acl.erl
18
src/acl.erl
@ -39,14 +39,14 @@
|
||||
-type acl_rule() :: {user, {binary(), binary()} | binary()} |
|
||||
{server, binary()} |
|
||||
{resource, binary()} |
|
||||
{user_regexp, {re:mp(), binary()} | re:mp()} |
|
||||
{server_regexp, re:mp()} |
|
||||
{resource_regexp, re:mp()} |
|
||||
{node_regexp, {re:mp(), re:mp()}} |
|
||||
{user_glob, {re:mp(), binary()} | re:mp()} |
|
||||
{server_glob, re:mp()} |
|
||||
{resource_glob, re:mp()} |
|
||||
{node_glob, {re:mp(), re:mp()}} |
|
||||
{user_regexp, {re_mp(), binary()} | re_mp()} |
|
||||
{server_regexp, re_mp()} |
|
||||
{resource_regexp, re_mp()} |
|
||||
{node_regexp, {re_mp(), re_mp()}} |
|
||||
{user_glob, {re_mp(), binary()} | re_mp()} |
|
||||
{server_glob, re_mp()} |
|
||||
{resource_glob, re_mp()} |
|
||||
{node_glob, {re_mp(), re_mp()}} |
|
||||
{shared_group, {binary(), binary()} | binary()} |
|
||||
{ip, ip_mask()}.
|
||||
-type access() :: [{action(), [access_rule()]}].
|
||||
@ -348,7 +348,7 @@ node_validator(UV, SV) ->
|
||||
%%%===================================================================
|
||||
%%% Aux
|
||||
%%%===================================================================
|
||||
-spec match_regexp(iodata(), re:mp()) -> boolean().
|
||||
-spec match_regexp(iodata(), re_mp()) -> boolean().
|
||||
match_regexp(Data, RegExp) ->
|
||||
re:run(Data, RegExp) /= nomatch.
|
||||
|
||||
|
@ -431,7 +431,7 @@ is_equal_opt(Opt, NewOpts, OldOpts) ->
|
||||
%%%===================================================================
|
||||
-spec format_module_error(atom(), start | reload, non_neg_integer(), opts(),
|
||||
error | exit | throw, any(),
|
||||
[erlang:stack_item()]) -> iolist().
|
||||
[tuple()]) -> iolist().
|
||||
format_module_error(Module, Fun, Arity, Opts, Class, Reason, St) ->
|
||||
case {Class, Reason} of
|
||||
{error, {bad_return, Module, {error, _} = Err}} ->
|
||||
|
@ -72,7 +72,7 @@
|
||||
user_desc = <<"">> :: binary(),
|
||||
user_uid = <<"">> :: binary(),
|
||||
uid_format = <<"">> :: binary(),
|
||||
uid_format_re :: undefined | re:mp(),
|
||||
uid_format_re :: undefined | re_mp(),
|
||||
filter = <<"">> :: binary(),
|
||||
ufilter = <<"">> :: binary(),
|
||||
rfilter = <<"">> :: binary(),
|
||||
|
Loading…
Reference in New Issue
Block a user