diff options
author | Hans Bolinder <[email protected]> | 2019-02-25 08:06:17 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-02-25 08:06:17 +0100 |
commit | d6b3eb786192800d0b3903bb591ed49d007a1f3d (patch) | |
tree | 37a1dd2a1fedf11cd2e35c758ca4eef409e4ad7a /lib/dialyzer/test/small_SUITE_data | |
parent | 39968f062e14365f12648070dd8edfd55a4f0e99 (diff) | |
parent | b67ddedf0212079204effbb061f31b7366dff95b (diff) | |
download | otp-d6b3eb786192800d0b3903bb591ed49d007a1f3d.tar.gz otp-d6b3eb786192800d0b3903bb591ed49d007a1f3d.tar.bz2 otp-d6b3eb786192800d0b3903bb591ed49d007a1f3d.zip |
Merge branch 'dialyzer/hasse/fix_bug_erl_bif_types/OTP-15570' into maint
* dialyzer/hasse/fix_bug_erl_bif_types/OTP-15570:
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. |