From 4ca72667f3e655d175c7587b8998aa7d22f50985 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Sun, 22 Jan 2012 17:43:48 +0100 Subject: 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". --- lib/dialyzer/test/small_SUITE_data/src/no_local_return.erl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 lib/dialyzer/test/small_SUITE_data/src/no_local_return.erl (limited to 'lib/dialyzer/test/small_SUITE_data/src') 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). -- cgit v1.2.3 From 3cc9dc31c5935168051286d524618b2b64795498 Mon Sep 17 00:00:00 2001 From: Stavros Aronis Date: Tue, 13 Mar 2012 17:27:50 +0100 Subject: Ensure that -on_load functions are not reported as unused --- lib/dialyzer/test/small_SUITE_data/src/on_load.erl | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 lib/dialyzer/test/small_SUITE_data/src/on_load.erl (limited to 'lib/dialyzer/test/small_SUITE_data/src') diff --git a/lib/dialyzer/test/small_SUITE_data/src/on_load.erl b/lib/dialyzer/test/small_SUITE_data/src/on_load.erl new file mode 100644 index 0000000000..16533a9caa --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/on_load.erl @@ -0,0 +1,11 @@ +%%% This is to ensure that "on_load" functions are never reported as unused. + +-module(on_load). + +-export([foo/0]). + +-on_load(bar/0). + +foo() -> ok. + +bar() -> ok. -- cgit v1.2.3