Why does Dialyzer check only the first case of the function?
-spec f(integer()) -> integer().
f(0) -> 0;
f(_) -> test.
Proceeding with analysis... done in 0m0.25s done (passed successfully)
The version with "case" also passes the check:
-spec f(integer()) -> integer().
f(N) ->
case N of
0 -> 1;
_ -> test
end.
Dialyzer version is 4.4.3
If passes, because you have just told it what the function is supposed to do. If you try and call the function with different arguments from the specification, then you would get a warning:
gives the dialyzer output: