aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2016-05-17 09:07:29 +0200
committerHans Bolinder <[email protected]>2016-06-09 11:28:00 +0200
commite44b4c47605cce574222e1bc579fb1d71dee064f (patch)
treea97cf040f4ffea0c3dbde7403c43e2c13adf5f54
parent13e0b9420276b71bdac89692f00dc20c3112bc1b (diff)
downloadotp-e44b4c47605cce574222e1bc579fb1d71dee064f.tar.gz
otp-e44b4c47605cce574222e1bc579fb1d71dee064f.tar.bz2
otp-e44b4c47605cce574222e1bc579fb1d71dee064f.zip
dialyzer: Suppress unmatched_return for send/2
-rw-r--r--lib/dialyzer/src/dialyzer_dataflow.erl6
-rw-r--r--lib/dialyzer/test/unmatched_returns_SUITE_data/src/send.erl11
2 files changed, 16 insertions, 1 deletions
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}.