diff options
author | Stavros Aronis <[email protected]> | 2012-01-22 17:43:48 +0100 |
---|---|---|
committer | Stavros Aronis <[email protected]> | 2012-02-22 14:13:08 +0100 |
commit | 4ca72667f3e655d175c7587b8998aa7d22f50985 (patch) | |
tree | 307e4372295330fbc3db75fb772ef370bcc85ba9 /lib/dialyzer/test/small_SUITE_data | |
parent | 7c3a98b560a80878c603fabe26ca4a572bfe9122 (diff) | |
download | otp-4ca72667f3e655d175c7587b8998aa7d22f50985.tar.gz otp-4ca72667f3e655d175c7587b8998aa7d22f50985.tar.bz2 otp-4ca72667f3e655d175c7587b8998aa7d22f50985.zip |
Zero-arity unused functions Dialyzer patch
Dialyzer was not reporting unused functions with 0 arity. This was not
a real issue, until we found out that there could be cases where this
could lead to false warnings. This was the case in "no_local_return.erl".
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data')
4 files changed, 17 insertions, 2 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify b/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify index 87bf6f309f..06dc0d63ee 100644 --- a/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify +++ b/lib/dialyzer/test/small_SUITE_data/results/cerl_hipeify @@ -1,4 +1,4 @@ cerl_hipeify.erl:370: Function will never be called -cerl_hipeify.erl:370: Guard test fun((none()) -> none()) =:= F::{_,_,_} | {_,_,_,_} | {_,_,_,_,_} | {_,_,_,_,_,_} | {_,_,_,_,_,_,_} can never succeed +cerl_hipeify.erl:370: Guard test fun((none()) -> no_return()) =:= F::{_,_,_} | {_,_,_,_} | {_,_,_,_,_} | {_,_,_,_,_,_} | {_,_,_,_,_,_,_} can never succeed cerl_hipeify.erl:641: Function env__new_function_name/2 will never be called diff --git a/lib/dialyzer/test/small_SUITE_data/results/inf_loop2 b/lib/dialyzer/test/small_SUITE_data/results/inf_loop2 index 7e9972ad98..142e4b2c37 100644 --- a/lib/dialyzer/test/small_SUITE_data/results/inf_loop2 +++ b/lib/dialyzer/test/small_SUITE_data/results/inf_loop2 @@ -1,4 +1,4 @@ inf_loop2.erl:18: Function test/0 has no local return inf_loop2.erl:19: The call lists:reverse('gazonk') will never return since it differs in the 1st argument from the success typing arguments: ([any()]) -inf_loop2.erl:22: Function loop/0 has no local return +inf_loop2.erl:22: Function loop/0 will never be called diff --git a/lib/dialyzer/test/small_SUITE_data/results/no_local_return b/lib/dialyzer/test/small_SUITE_data/results/no_local_return new file mode 100644 index 0000000000..6ca1ed51d8 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/no_local_return @@ -0,0 +1,3 @@ + +no_local_return.erl:11: Function bar/1 will never be called +no_local_return.erl:8: Function foo/0 will never be called diff --git a/lib/dialyzer/test/small_SUITE_data/src/no_local_return.erl b/lib/dialyzer/test/small_SUITE_data/src/no_local_return.erl new file mode 100644 index 0000000000..4e1a0b015a --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/no_local_return.erl @@ -0,0 +1,12 @@ +-module(no_local_return). + +%% NOTE: No function is exported. Dialyzer produced a bogus +%% 'Function foo/0 has no local return' warning +%% when in fact typer was finding correct return values for both +%% these functions. + +foo() -> + bar(42). + +bar(X) -> + lists:duplicate(X, gazonk). |