Advertisement
zamotivator

Untitled

Oct 5th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 1.22 KB | None | 0 0
  1. ➜ cat my_test.hrl
  2. -type my_enum() :: atom1 |
  3.                    atom2 .
  4. -spec check(my_enum()) -> boolean().
  5. oleg@x200:~/dev
  6. ➜ cat my_test.erl
  7. -module(my_test).
  8. -include_lib("my_test.hrl").
  9. -export([check/1, do_test/0]).
  10.  
  11. check(Data) ->
  12.     io:format("data ~p~n", [Data]).
  13.  
  14. do_test() ->
  15.     check(atom1),
  16.     check(bad),
  17.     check(atom2).
  18. oleg@x200:~/dev
  19. ➜ erlc -d +debug_info -Wall my_test.erl
  20.  erl +sbtu +A0 -noinput -mode minimal -boot start_clean -s erl_compile compile_cmdline -extra +debug_info -Wall my_test.erl
  21. oleg@x200:~/dev
  22. ➜ dialyzer --build_plt my_test.beam
  23.   Creating PLT /home/oleg/.dialyzer_plt ...
  24. Unknown functions:
  25.   erlang:get_module_info/1
  26.   erlang:get_module_info/2
  27.   io:format/2
  28.  done in 0m0.34s
  29. done (passed successfully)
  30. oleg@x200:~/dev
  31. ➜ dialyzer --src my_test.erl
  32.   Checking whether the PLT /home/oleg/.dialyzer_plt is up-to-date... yes
  33.   Proceeding with analysis...
  34. my_test.erl:8: Function do_test/0 has no local return
  35. my_test.erl:10: The call my_test:check('bad') breaks the contract (my_enum()) -> boolean()
  36. Unknown functions:
  37.   erlang:get_module_info/1
  38.   erlang:get_module_info/2
  39.   io:format/2
  40.  done in 0m0.24s
  41. done (warnings were emitted)
  42. ➜ echo $?
  43. 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement