aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl b/lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl
new file mode 100644
index 0000000000..53f7e934e4
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl
@@ -0,0 +1,25 @@
+%%-----------------------------------------------------------------------------
+%% Test which produces an erroneous warning:
+%% Guard test is_atom(A::'bar' | 'foo') can never succeed
+%% due to the handling of not which of course succeeds when its argument fails
+%%-----------------------------------------------------------------------------
+-module(not_bogus_warning).
+
+-export([t1/0, t2/0, t3/0, t4/0]).
+
+t1() ->
+ [A || A <- [foo, bar], not is_atom(A)].
+
+t2() ->
+ [A || A <- [foo, bar], not is_integer(A)].
+
+t3() ->
+ should_we_warn_here(42).
+
+should_we_warn_here(X) when is_integer(X) -> int.
+
+t4() ->
+ should_we_warn_or_not(42).
+
+should_we_warn_or_not(X) when not is_integer(X) -> not_int;
+should_we_warn_or_not(X) -> int.