diff options
author | Hans Bolinder <[email protected]> | 2019-02-25 08:09:45 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-02-25 08:09:45 +0100 |
commit | c13aea731bb672afacd4fbc0594649957bbffb8a (patch) | |
tree | a24364d7b614d06b5ab3320f6b7736b37cf0e0b5 /lib/dialyzer/test/small_SUITE_data | |
parent | 6053c0e4d7e579a57629c5610ee6c1dc185d2a46 (diff) | |
parent | d6b3eb786192800d0b3903bb591ed49d007a1f3d (diff) | |
download | otp-c13aea731bb672afacd4fbc0594649957bbffb8a.tar.gz otp-c13aea731bb672afacd4fbc0594649957bbffb8a.tar.bz2 otp-c13aea731bb672afacd4fbc0594649957bbffb8a.zip |
Merge branch 'maint'
* maint:
dialyzer: Fix maps as parameter of opaque types
dialyzer: Fix key check of lists:key{search,member,find}()
Diffstat (limited to 'lib/dialyzer/test/small_SUITE_data')
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/lists_key_bug.erl | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/lib/dialyzer/test/small_SUITE_data/src/lists_key_bug.erl b/lib/dialyzer/test/small_SUITE_data/src/lists_key_bug.erl index d7cbc27a4d..ad5cf3c503 100644 --- a/lib/dialyzer/test/small_SUITE_data/src/lists_key_bug.erl +++ b/lib/dialyzer/test/small_SUITE_data/src/lists_key_bug.erl @@ -2,10 +2,11 @@ %% OTP-15570 --export([t/1]). +-export([is_1/1, is_2/1, i/1, t1/0, t2/0, im/0]). -t(V) -> - K = key(V), +%% int_set([3]) +is_1(V) -> + K = ikey(V), case lists:keyfind(K, 1, [{<<"foo">>, bar}]) of false -> a; @@ -13,7 +14,62 @@ t(V) -> b end. -key(1) -> +ikey(1) -> 3; -key(2) -> +ikey(2) -> <<"foo">>. + +%% int_set([3, 5]) +is_2(V) -> + K = iskey(V), + case lists:keyfind(K, 1, [{<<"foo">>, bar}]) of + false -> + a; + {_, _} -> + b + end. + +iskey(1) -> + 12; +iskey(2) -> + 14; +iskey(3) -> + <<"foo">>. + +%% integer() +i(V) -> + K = intkey(V), + case lists:keyfind(K, 1, [{9.0, foo}]) of + false -> + a; + {_, _} -> + b + end. + +intkey(K) when is_integer(K) -> + K + 9999. + +t1() -> + case lists:keyfind({17}, 1, [{{17.0}, true}]) of + false -> + a; + {_, _} -> + b + end. + +t2() -> + case lists:keyfind({17.0}, 1, [{{17}, true}]) of + false -> + a; + {_, _} -> + b + end. + +%% Note: #{1.0 => a} =/= #{1 => a}. +im() -> + case lists:keyfind(#{1.0 => a}, 1, [{#{1 => a}, foo}]) of + false -> + a; + {_, _} -> + b + end. |