aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dialyzer
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dialyzer')
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/guard_warnings97
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/guard_warnings.erl118
2 files changed, 215 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/guard_warnings b/lib/dialyzer/test/small_SUITE_data/results/guard_warnings
new file mode 100644
index 0000000000..0ff998bf50
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/results/guard_warnings
@@ -0,0 +1,97 @@
+
+guard_warnings.erl:100: Function test45/0 has no local return
+guard_warnings.erl:100: Guard test 'not'('true') can never succeed
+guard_warnings.erl:102: Function test46/1 has no local return
+guard_warnings.erl:102: Guard test X::'true' =:= 'false' can never succeed
+guard_warnings.erl:104: Function test47/1 has no local return
+guard_warnings.erl:104: Guard test X::'true' == 'false' can never succeed
+guard_warnings.erl:106: Function test48/1 has no local return
+guard_warnings.erl:106: Guard test X::'true' =/= 'true' can never succeed
+guard_warnings.erl:114: Function test52_w/1 has no local return
+guard_warnings.erl:118: Function test54_w/1 has no local return
+guard_warnings.erl:12: Function test1/1 has no local return
+guard_warnings.erl:12: Guard test X::'true' =:= 'false' can never succeed
+guard_warnings.erl:14: Function test2/1 has no local return
+guard_warnings.erl:14: Guard test X::'false' =:= 'true' can never succeed
+guard_warnings.erl:16: Function test3/1 has no local return
+guard_warnings.erl:16: Guard test 'not'(X::'true') can never succeed
+guard_warnings.erl:18: Function test4/1 has no local return
+guard_warnings.erl:18: Guard test 'and'('true',X::none()) can never succeed
+guard_warnings.erl:20: Function test5/1 has no local return
+guard_warnings.erl:20: Guard test 'not'(X::'true') can never succeed
+guard_warnings.erl:22: Function test6/1 has no local return
+guard_warnings.erl:22: Guard test 'and'('true',X::none()) can never succeed
+guard_warnings.erl:24: Function test7_w/1 has no local return
+guard_warnings.erl:26: Function test8_w/1 has no local return
+guard_warnings.erl:28: Function test9/1 has no local return
+guard_warnings.erl:28: Guard test not('not'(X::'false')) can never succeed
+guard_warnings.erl:30: Function test10/1 has no local return
+guard_warnings.erl:30: Guard test not('or'('false',X::none())) can never succeed
+guard_warnings.erl:32: Function test11/1 has no local return
+guard_warnings.erl:32: Guard test not('not'(X::'false')) can never succeed
+guard_warnings.erl:34: Function test12/1 has no local return
+guard_warnings.erl:34: Guard test not('or'('false',X::none())) can never succeed
+guard_warnings.erl:36: Function test13/1 has no local return
+guard_warnings.erl:36: Guard test 'and'('true','false') can never succeed
+guard_warnings.erl:38: Function test14/1 has no local return
+guard_warnings.erl:38: Guard test 'and'('false',any()) can never succeed
+guard_warnings.erl:40: Function test15/1 has no local return
+guard_warnings.erl:40: Guard test 'and'(X::'true','false') can never succeed
+guard_warnings.erl:42: Function test16/1 has no local return
+guard_warnings.erl:42: Guard test 'and'('false',X::any()) can never succeed
+guard_warnings.erl:44: Function test17/1 has no local return
+guard_warnings.erl:44: Guard test 'and'(X::'true','false') can never succeed
+guard_warnings.erl:46: Function test18/1 has no local return
+guard_warnings.erl:46: Guard test 'and'('false',X::any()) can never succeed
+guard_warnings.erl:48: Function test19/1 has no local return
+guard_warnings.erl:48: Guard test not('or'('true',any())) can never succeed
+guard_warnings.erl:50: Function test20/1 has no local return
+guard_warnings.erl:50: Guard test not('or'('false','true')) can never succeed
+guard_warnings.erl:52: Function test21/1 has no local return
+guard_warnings.erl:52: Guard test not('or'('true',X::any())) can never succeed
+guard_warnings.erl:54: Function test22/1 has no local return
+guard_warnings.erl:54: Guard test not('or'(X::'false','true')) can never succeed
+guard_warnings.erl:56: Function test23/1 has no local return
+guard_warnings.erl:56: Guard test not('or'('true',X::any())) can never succeed
+guard_warnings.erl:58: Function test24/1 has no local return
+guard_warnings.erl:58: Guard test not('or'(X::'false','true')) can never succeed
+guard_warnings.erl:60: Function test25/1 has no local return
+guard_warnings.erl:60: Guard test 'and'('false',any()) can never succeed
+guard_warnings.erl:62: Function test26/1 has no local return
+guard_warnings.erl:62: Guard test 'and'('true','false') can never succeed
+guard_warnings.erl:64: Function test27/1 has no local return
+guard_warnings.erl:64: Guard test 'and'('false',X::any()) can never succeed
+guard_warnings.erl:66: Function test28/1 has no local return
+guard_warnings.erl:66: Guard test 'and'(X::'true','false') can never succeed
+guard_warnings.erl:68: Function test29/1 has no local return
+guard_warnings.erl:68: Guard test 'and'('false',X::any()) can never succeed
+guard_warnings.erl:70: Function test30/1 has no local return
+guard_warnings.erl:70: Guard test 'and'(X::'true','false') can never succeed
+guard_warnings.erl:72: Function test31/0 has no local return
+guard_warnings.erl:72: Guard test 'and'('false',any()) can never succeed
+guard_warnings.erl:74: Function test32/0 has no local return
+guard_warnings.erl:74: Guard test 'and'('false',any()) can never succeed
+guard_warnings.erl:76: Function test33/0 has no local return
+guard_warnings.erl:76: Guard test not('and'('true','true')) can never succeed
+guard_warnings.erl:78: Function test34/0 has no local return
+guard_warnings.erl:78: Guard test 'and'('false',any()) can never succeed
+guard_warnings.erl:80: Function test35/0 has no local return
+guard_warnings.erl:80: Guard test not('and'('true','true')) can never succeed
+guard_warnings.erl:82: Function test36/0 has no local return
+guard_warnings.erl:82: Guard test 'or'('false','false') can never succeed
+guard_warnings.erl:84: Function test37/0 has no local return
+guard_warnings.erl:84: Guard test 'or'('false','false') can never succeed
+guard_warnings.erl:86: Function test38/0 has no local return
+guard_warnings.erl:86: Guard test 'or'('false','false') can never succeed
+guard_warnings.erl:88: Function test39/0 has no local return
+guard_warnings.erl:88: Guard test 'or'('false','false') can never succeed
+guard_warnings.erl:90: Function test40/0 has no local return
+guard_warnings.erl:90: Guard test 'or'('false','false') can never succeed
+guard_warnings.erl:92: Function test41/0 has no local return
+guard_warnings.erl:92: Guard test 'true' =:= 'false' can never succeed
+guard_warnings.erl:94: Function test42/0 has no local return
+guard_warnings.erl:94: Guard test 'true' == 'false' can never succeed
+guard_warnings.erl:96: Function test43/0 has no local return
+guard_warnings.erl:96: Guard test 'true' =:= 'false' can never succeed
+guard_warnings.erl:98: Function test44/0 has no local return
+guard_warnings.erl:98: Guard test not('true' == 'true') can never succeed
diff --git a/lib/dialyzer/test/small_SUITE_data/src/guard_warnings.erl b/lib/dialyzer/test/small_SUITE_data/src/guard_warnings.erl
new file mode 100644
index 0000000000..6ab13eef9a
--- /dev/null
+++ b/lib/dialyzer/test/small_SUITE_data/src/guard_warnings.erl
@@ -0,0 +1,118 @@
+%%
+%% A couple of tests for booleans in guards.
+%% Tests with suffix w have incomplete results due to weak dataflow.
+%% Tests with suffix ww have incomplete results due to weak dialyzer.
+%% Tests with suffix x should not give warnings.
+%%
+
+-module(and_bug).
+
+-compile(export_all).
+
+test1(X) when X and not X -> never.
+
+test2(X) when not X and X -> never.
+
+test3(X) when (X and not X) =:= true -> never.
+
+test4(X) when (not X and X) =:= true -> never.
+
+test5(X) when (X and not X) == true -> never.
+
+test6(X) when (not X and X) == true -> never.
+
+test7_w(X) when not (X or not X) -> never.
+
+test8_w(X) when not (not X or X) -> never.
+
+test9(X) when (X or not X) =:= false -> never.
+
+test10(X) when (not X or X) =:= false -> never.
+
+test11(X) when (X or not X) == false -> never.
+
+test12(X) when (not X or X) == false -> never.
+
+test13(X) when X and false -> never.
+
+test14(X) when false and X -> never.
+
+test15(X) when (X and false) =:= true -> never.
+
+test16(X) when (false and X) =:= true -> never.
+
+test17(X) when (X and false) == true -> never.
+
+test18(X) when (false and X) == true -> never.
+
+test19(X) when not (true or X) -> never.
+
+test20(X) when not (X or true) -> never.
+
+test21(X) when (true or X) =:= false -> never.
+
+test22(X) when (X or true) =:= false -> never.
+
+test23(X) when (true or X) == false -> never.
+
+test24(X) when (X or true) == false -> never.
+
+test25(X) when (false and X) -> never.
+
+test26(X) when (X and false) -> never.
+
+test27(X) when (false and X) =:= true -> never.
+
+test28(X) when (X and false) =:= true -> never.
+
+test29(X) when (false and X) == true -> never.
+
+test30(X) when (X and false) == true -> never.
+
+test31() when false and false -> never.
+
+test32() when (false and false) =:= true -> never.
+
+test33() when not (true and true) =:= true -> never.
+
+test34() when (false and false) == true -> never.
+
+test35() when not (true and true) == true -> never.
+
+test36() when false or false -> never.
+
+test37() when (false or false) =:= true -> never.
+
+test38() when not (false or false) =:= false -> never.
+
+test39() when (false or false) == true -> never.
+
+test40() when not (false or false) == false -> never.
+
+test41() when true =:= false -> never.
+
+test42() when true == false -> never.
+
+test43() when not (true =:= true) -> never.
+
+test44() when not (true == true) -> never.
+
+test45() when not (not (not (not (not (not (not true)))))) -> never.
+
+test46(X) when (X =:= true) and (X =:= false) -> never.
+
+test47(X) when (X == true) and (X == false) -> never.
+
+test48(X) when is_boolean(X) and (X =:= true) and (X =/= true) -> never.
+
+test49_x(X) when not (X or X) -> maybe.
+
+test50_x(X) when not (X and X) -> maybe.
+
+test51_x(X) when not (not X) -> maybe.
+
+test52_w(X) when is_boolean(X) and (X =/= true) and (X =:= true) -> never.
+
+test53_ww(X) when is_boolean(X) and (X =/= true) and (X =/= false) -> never.
+
+test54_w(X) when is_boolean(X) and not ((X =:= true) or (X =:= false)) -> never.