Eunit assert causes Dialyzer warning

Magnus Henoch <>
Fri Jun 11 18:14:29 CEST 2010

In R13B04 (and probably others), putting an Eunit ?assert in the code
will sometimes cause a Dialyzer warning, as below.  This happens because
the definition of the assert macro in eunit.hrl does an extra check for
when the value is neither true nor false, but in this case Dialyzer can
infer that the value must be either true or false.

It would be nice if either Eunit or Dialyzer could be changed to not
output this warning, so I don't get distracted from warnings that might
indicate actual problems.

$ cat > foo.erl



foo(X) ->
$ dialyzer --src foo.erl
  Checking whether the PLT /home/magnus/.dialyzer_plt is up-to-date... yes
  Proceeding with analysis...
foo.erl:8: The variable _ can never match since previous clauses completely covered the type 'false'
 done in 0m0.57s
done (warnings were emitted)

Magnus Henoch, 
Erlang Solutions



Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

More information about the erlang-bugs mailing list