/lib/dialyzer/test/map_SUITE_data/src/order.erl

https://github.com/cmullaparthi/otp · Erlang · 56 lines · 44 code · 12 blank · 0 comment · 0 complexity · f0d2dfe84523facae3589a660f3916e0 MD5 · raw file

  1. -module(order).
  2. -export([t1/0, t2/0, t3/0, t4/0, t5/0, t6/0]).
  3. t1() ->
  4. case maps:get(a, #{a=>1, a=>b}) of
  5. Int when is_integer(Int) -> fail;
  6. Atom when is_atom(Atom) -> error(ok);
  7. _Else -> fail
  8. end.
  9. t2() ->
  10. case maps:get(a, #{a=>id_1(1), a=>id_b(b)}) of
  11. Int when is_integer(Int) -> fail;
  12. Atom when is_atom(Atom) -> error(ok);
  13. _Else -> fail
  14. end.
  15. t3() ->
  16. case maps:get(a, #{a=>id_1(1), id_a(a)=>id_b(b)}) of
  17. Int when is_integer(Int) -> fail;
  18. Atom when is_atom(Atom) -> error(ok);
  19. _Else -> fail
  20. end.
  21. t4() ->
  22. case maps:get(a, #{a=>id_1(1), a_or_b()=>id_b(b)}) of
  23. Int when is_integer(Int) -> ok;
  24. Atom when is_atom(Atom) -> ok;
  25. _Else -> fail
  26. end.
  27. t5() ->
  28. case maps:get(c, #{c=>id_1(1), a_or_b()=>id_b(b)}) of
  29. Int when is_integer(Int) -> error(ok);
  30. Atom when is_atom(Atom) -> fail;
  31. _Else -> fail
  32. end.
  33. t6() ->
  34. case maps:get(a, #{a_or_b()=>id_1(1), id_a(a)=>id_b(b)}) of
  35. Int when is_integer(Int) -> fail;
  36. Atom when is_atom(Atom) -> error(ok);
  37. _Else -> fail
  38. end.
  39. id_1(X) -> X.
  40. id_a(X) -> X.
  41. id_b(X) -> X.
  42. any() -> binary_to_term(<<>>).
  43. -spec a_or_b() -> a | b.
  44. a_or_b() -> any().