diff options
author | Stavros Aronis <[email protected]> | 2011-03-21 18:36:50 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-05-04 15:06:16 +0200 |
commit | 500567d6e12d1827f31cd52b961ed7a7e9fb9fa7 (patch) | |
tree | cba1e701171bee8d8e902db4127177beca448127 /lib | |
parent | 50184171c3b28270aae9f21926383185e9188234 (diff) | |
download | otp-500567d6e12d1827f31cd52b961ed7a7e9fb9fa7.tar.gz otp-500567d6e12d1827f31cd52b961ed7a7e9fb9fa7.tar.bz2 otp-500567d6e12d1827f31cd52b961ed7a7e9fb9fa7.zip |
Add small/not_bogus_warning
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/results/not_bogus_warning | 3 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/not_bogus_warning.erl | 25 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/results/not_bogus_warning b/lib/dialyzer/test/small_SUITE_data/results/not_bogus_warning new file mode 100644 index 0000000000..e3a7f6b444 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/not_bogus_warning @@ -0,0 +1,3 @@ + +not_bogus_warning.erl:11: Guard test not(is_atom(A::'bar' | 'foo')) can never succeed +not_bogus_warning.erl:24: Guard test not(is_integer(X::42)) can never succeed 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. |