I have a very minimalistic function that can return a boolean or blow up:
defmodule TestDialzer do @spec hello(integer) :: boolean def hello(n) do if n == 10 do true else raise "This is not a number!" end end end
As you can see, this function can return a boolean. But it can also not return one. Dialyzer is not picking this up:
Starting Dialyzer [ check_plt: false, init_plt: '/home/pedro/Workplace/test_dialzer/_build/dev/dialyxir_erlang-23.3_elixir-1.12.0_deps-dev.plt', files: ['/home/pedro/Workplace/test_dialzer/_build/dev/lib/test_dialzer/ebin/Elixir.TestDialzer.beam'], warnings: [:unknown] ] Total errors: 0, Skipped: 0, Unnecessary Skips: 0 done in 0m0.77s done (passed successfully)
My spec is incomplete and I expected dialyzer to fail with some kind of error / warning.
Why is dialyzer not complaining? (rare thing to ask, I know)