diff options
author | Magnus Lång <[email protected]> | 2016-02-27 23:29:43 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-04-28 16:16:09 +0200 |
commit | 92a672ff8159741ebbc9f3eb11e8a81d7067d2c7 (patch) | |
tree | 24268f010ffdc6def5cb658df4698471832e26f6 /lib/dialyzer/test/map_SUITE_data/src/order.erl | |
parent | a13d4a750dfdf9a2a96d1e7ec0054644187afa59 (diff) | |
download | otp-92a672ff8159741ebbc9f3eb11e8a81d7067d2c7.tar.gz otp-92a672ff8159741ebbc9f3eb11e8a81d7067d2c7.tar.bz2 otp-92a672ff8159741ebbc9f3eb11e8a81d7067d2c7.zip |
dialyzer_typesig: Add map support
Diffstat (limited to 'lib/dialyzer/test/map_SUITE_data/src/order.erl')
-rw-r--r-- | lib/dialyzer/test/map_SUITE_data/src/order.erl | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/dialyzer/test/map_SUITE_data/src/order.erl b/lib/dialyzer/test/map_SUITE_data/src/order.erl new file mode 100644 index 0000000000..51868d7e94 --- /dev/null +++ b/lib/dialyzer/test/map_SUITE_data/src/order.erl @@ -0,0 +1,56 @@ +-module(order). + +-export([t1/0, t2/0, t3/0, t4/0, t5/0, t6/0]). + +t1() -> + case maps:get(a, #{a=>1, a=>b}) of + Int when is_integer(Int) -> fail; + Atom when is_atom(Atom) -> error(ok); + _Else -> fail + end. + +t2() -> + case maps:get(a, #{a=>id_1(1), a=>id_b(b)}) of + Int when is_integer(Int) -> fail; + Atom when is_atom(Atom) -> error(ok); + _Else -> fail + end. + +t3() -> + case maps:get(a, #{a=>id_1(1), id_a(a)=>id_b(b)}) of + Int when is_integer(Int) -> fail; + Atom when is_atom(Atom) -> error(ok); + _Else -> fail + end. + +t4() -> + case maps:get(a, #{a=>id_1(1), a_or_b()=>id_b(b)}) of + Int when is_integer(Int) -> ok; + Atom when is_atom(Atom) -> ok; + _Else -> fail + end. + +t5() -> + case maps:get(c, #{c=>id_1(1), a_or_b()=>id_b(b)}) of + Int when is_integer(Int) -> error(ok); + Atom when is_atom(Atom) -> fail; + _Else -> fail + end. + +t6() -> + case maps:get(a, #{a_or_b()=>id_1(1), id_a(a)=>id_b(b)}) of + Int when is_integer(Int) -> fail; + Atom when is_atom(Atom) -> error(ok); + _Else -> fail + end. + +id_1(X) -> X. + +id_a(X) -> X. + +id_b(X) -> X. + +any() -> binary_to_term(<<>>). + +-spec a_or_b() -> a | b. +a_or_b() -> any(). |