<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6001.18349" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face="Courier New" color=#800000
size=2></FONT> </DIV>
<DIV><SPAN class=760344815-19042011></SPAN><FONT face="Courier New"><FONT
color=#800000><FONT size=2>Hi!</FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New"><FONT color=#800000><FONT
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT
size=2>I<SPAN class=760344815-19042011> ran 'erlc -P' on the example in the post
you found on the internet, with the following
result:</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT><FONT face="Courier New" color=#800000 size=2><SPAN
class=760344815-19042011></SPAN></FONT></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><FONT><FONT face="Courier New" size=2><SPAN
class=760344815-19042011>...</SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT><FONT><SPAN class=760344815-19042011>foo(X) ->
<BR> ?assert(is_list(X)), </SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT><FONT size=2><SPAN
class=760344815-19042011>...</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT size=2><SPAN
class=760344815-19042011></SPAN></FONT></FONT></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT size=2><SPAN
class=760344815-19042011>becomes</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT size=2><SPAN
class=760344815-19042011></SPAN></FONT></FONT></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT size=2><SPAN
class=760344815-19042011>...</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT face="Courier New"><FONT color=#800000><FONT size=2><SPAN
class=760344815-19042011>foo(X) -><BR> fun()
-><BR> case
is_list(X)
of<BR>
true
-><BR>
ok;<BR>
__V
-><BR>
.erlang:error({assertion_failed,<BR>
[{module,foo},<BR>
{line,8},<BR>
{expression,"is_list ( X
)"},<BR>
{expected,true},<BR>
{value,<BR>
case __V
of<BR>
false
-><BR>
__V;<BR>
_
-><BR>
{not_a_boolean,__V}<BR>
end}]})<BR>
end<BR>
end(),<BR>...</SPAN></FONT></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face="Courier New" color=#800000 size=2></FONT><FONT
face="Courier New" color=#800000 size=2></FONT> </DIV>
<DIV><SPAN class=760344815-19042011><FONT face="Courier New" color=#800000
size=2>Indeed, the '_' case in the nested statement cannot occur, since __V
is always 'false' in that branch. I'm guessing that if you run 'erlc -P'
on your own example, you will find something similar in the pre-processed
code.</FONT></SPAN></DIV>
<DIV><FONT face="Courier New" color=#800000 size=2></FONT> </DIV>
<DIV><SPAN class=760344815-19042011><FONT face="Courier New" color=#800000
size=2>BR,</FONT></SPAN></DIV>
<DIV><SPAN class=760344815-19042011><FONT face="Courier New" color=#800000
size=2>Raphael Korsoski</FONT></SPAN></DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> erlang-questions-bounces@erlang.org
[mailto:erlang-questions-bounces@erlang.org] <B>On Behalf Of </B>Richard
Evans<BR><B>Sent:</B> den 19 april 2011 17:37<BR><B>To:</B> Erlang
Questions<BR><B>Subject:</B> [erlang-questions] Dialyzer generating spurious
warnings when using the ?assert macro<BR></FONT><BR></DIV>
<DIV></DIV>Hi guys,
<DIV><BR></DIV>
<DIV>I am going through adding typing to my functions and getting dialyzer to
verify everything, which is all working very nicely, apart from one minor
grievance:</DIV>
<DIV><BR></DIV>
<DIV>There are two places where I use the ?assert macro, and I believe dialyzer
is giving me spurious warnings on these lines:</DIV>
<DIV>
<P> interpretAction({implies, A, C, true}) ->
?assert(xl_string:impliesString(A,C));</P>
<P> interpretAction({implies, A, C, false}) -> ?assert(not
xl_string:impliesString(A,C));</P>
<DIV><BR></DIV>
<DIV>These generate the warnings:</DIV>
<DIV><BR></DIV>
<DIV>
<DIV> xl.erl:286: The variable _ can never match since
previous clauses completely covered the type 'false'</DIV>
<DIV> xl.erl:287: The variable _ can never match since
previous clauses completely covered the type 'false'</DIV></DIV>
<DIV><BR></DIV>
<DIV>I think these are problems with the macro and not with my code. Does
anybody have any info on this?</DIV></DIV>
<DIV><BR></DIV>
<DIV>I also found this post on the internet, where somebody else seems to have a
similar problem:</DIV>
<DIV><BR></DIV>
<DIV><A
href="http://erlang.2086793.n4.nabble.com/Eunit-assert-causes-Dialyzer-warning-td2252010.html"
target=_blank>http://erlang.2086793.n4.nabble.com/Eunit-assert-causes-Dialyzer-warning-td2252010.html</A></DIV>
<DIV><BR></DIV>
<DIV>Any help much appreciated</DIV>
<DIV><BR></DIV>
<DIV>thanks, </DIV>
<DIV>Richard</DIV></BODY></HTML>