<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br></div><div>Interesting.</div><div><br></div><div>I would have expected the spec written in the lists module to have triggered a warning message.</div><div><br></div><div>By adding any one of these specs, dialyzer does produce the desired warning message. </div><div><br></div><div><div>-module(foo).</div><div><br></div><div>-export([bar/2, baz/0]).</div><div><br></div><div>%%-spec bar(list(), list()) -> list().</div><div>%%-spec bar(list(term()), list(term())) -> list(term()).</div><div>%%-spec bar([term()], [term()]) -> [term()].</div><div>bar(A, B) -></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>lists:append(A, B).</div><div><br></div><div>baz() -></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>bar([], a).</div></div><div><br></div><div><br></div><div><div> dialyzer --plt ~/.dialyzer_plt.R16B ebin/foo.beam </div><div> Checking whether the PLT ~/.dialyzer_plt.R16B is up-to-date... yes</div><div> Proceeding with analysis...</div><div>foo.erl:10: Function baz/0 has no local return</div><div>foo.erl:11: The call foo:bar([],'a') breaks the contract ([term()],[term()]) -> [term()]</div><div> done in 0m6.70s</div><div>done (warnings were emitted)</div></div><div><br></div><div><br></div><br><div><div>On Mar 29, 2013, at 24:04 , Pierre Fenoll <<a href="mailto:pierrefenoll@gmail.com">pierrefenoll@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Dialyzer says it passed successfully.<br><br><div class="gmail_quote">On 28 March 2013 15:38, Joseph Wayne Norton <span dir="ltr"><<a href="mailto:norton@lovely.email.ne.jp" target="_blank">norton@lovely.email.ne.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Pierre -<br>
<br>
Just in case ... have you tried running Dialyzer on your program? If so, what does Dialyzer report?<br>
<br>
regards,<br>
<br>
Joe N.<br>
<div class="HOEnZb"><div class="h5"><br>
On Mar 28, 2013, at 11:12 PM, Pierre Fenoll <<a href="mailto:pierrefenoll@gmail.com">pierrefenoll@gmail.com</a>> wrote:<br>
<br>
> > It's not a contradiction, as kostis noted specs are not complete<br>
> > enumerations of all possible argument types.<br>
><br>
> Well, lists:append/2 asks for a list() as a second argument. Shouldn't<br>
> it badarg when I give it 'a', as in lists:append([], a) ?<br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
</div></div></blockquote></div><br>
</blockquote></div><br></body></html>