Erlang Mailing Lists

Author Message

<  Erlang bugs mailing list  ~  Eunit assert causes Dialyzer warning

mhenoch
Posted: Fri Jun 11, 2010 4:15 pm Reply with quote
User Joined: 06 Nov 2008 Posts: 29
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
-module(foo).

-include_lib("eunit/include/eunit.hrl").

-export([foo/1]).

foo(X) ->
?assert(is_list(X)),
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, magnus@erlang-solutions.com
Erlang Solutions
http://www.erlang-solutions.com/
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

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

www.erlang-solutions.com


________________________________________________________________
erlang-bugs (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-bugs-unsubscribe@erlang.org

---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

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

www.erlang-solutions.com

Post received from mailinglist
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum