From e44b4c47605cce574222e1bc579fb1d71dee064f Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Tue, 17 May 2016 09:07:29 +0200 Subject: dialyzer: Suppress unmatched_return for send/2 --- lib/dialyzer/src/dialyzer_dataflow.erl | 6 +++++- lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl diff --git a/lib/dialyzer/src/dialyzer_dataflow.erl b/lib/dialyzer/src/dialyzer_dataflow.erl index 3349b12932..59b4b0733e 100644 --- a/lib/dialyzer/src/dialyzer_dataflow.erl +++ b/lib/dialyzer/src/dialyzer_dataflow.erl @@ -2954,11 +2954,15 @@ is_call_to_send(Tree) -> Arity = cerl:call_arity(Tree), cerl:is_c_atom(Mod) andalso cerl:is_c_atom(Name) - andalso (cerl:atom_val(Name) =:= '!') + andalso is_send(cerl:atom_val(Name)) andalso (cerl:atom_val(Mod) =:= erlang) andalso (Arity =:= 2) end. +is_send('!') -> true; +is_send(send) -> true; +is_send(_) -> false. + is_lc_simple_list(Tree, TreeType, State) -> Opaques = State#state.opaques, Ann = cerl:get_ann(Tree), diff --git a/lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl b/lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl new file mode 100644 index 0000000000..4d681b5cc7 --- /dev/null +++ b/lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl @@ -0,0 +1,11 @@ +-module(send). + +-export([s/0]). + +s() -> + self() ! n(), % no warning + erlang:send(self(), n()), % no warning + ok. + +n() -> + {1, 1}. -- cgit v1.2.3