<div dir="ltr"><div>Hello Wei,<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 28 Apr 2019 at 21:38, WW <<a href="mailto:kingwang98@yahoo.com">kingwang98@yahoo.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_5123051821897398879yahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><div>Why dialyzer did not complain when I exported the function validator/1 ?</div><div><br></div><div>It means exported function allowing never reach the calls ?</div></div></div></blockquote><div><br></div><div>Because when you export said function, Dialyzer can't assume it won't be called from code outside its analysis scope (e.g. modules in uncovered apps, modules loaded in runtime, function references generated in run time, the shell, ..) and so it can't determine the full range of possible arguments - anything goes. And if anything goes, there's no way of saying: "this particular execution flow will never happen."</div><div><br></div><div>Which is usually not the case with internal functions, where all possible calling arguments /may/ be known when performing analysis, depending on your code and how precisely Dialyzer can track type constraints in it.<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_5123051821897398879yahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><div><br></div><div><br></div><div id="gmail-m_5123051821897398879yahoo_quoted_6961022268" class="gmail-m_5123051821897398879yahoo_quoted">
<div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;color:rgb(38,40,42)">
<div>
On Sunday, April 28, 2019, 9:30:03 PM GMT+2, Kostis Sagonas <<a href="mailto:kostis@cs.ntua.gr" target="_blank">kostis@cs.ntua.gr</a>> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">On 4/28/19 6:41 PM, WW wrote:<div class="gmail-m_5123051821897398879yqt8088745832" id="gmail-m_5123051821897398879yqtfd06685"><br clear="none">> <br clear="none">> What is the best solution to avoid dialyzer warnings meanwhile also <br clear="none">> satisfy my use cases.?</div><br clear="none">> <br clear="none"><br clear="none">One cannot really answer this question without knowing what your "use <br clear="none">case(s)" really is.,,,<br clear="none"><br clear="none">If it really is the code example you posted, if you pay close attention <br clear="none">to the warning that you get from dialyzer, dialyzer also tells you that <br clear="none">the call validator([]), let alone validator(3), is actually unreachable <br clear="none">code in your example. This is because dialyzer discovers that the prior <br clear="none">call (validator(undefined)) will throw an exit exception and <br clear="none">control-flow will never reach the validator([]) (and validator(3)) calls.<br clear="none"><br clear="none">Once again, remember the slogan: "Dialyzer is never wrong."<br clear="none"><br clear="none">Kostis<div class="gmail-m_5123051821897398879yqt8088745832" id="gmail-m_5123051821897398879yqtfd21975"><br clear="none"></div></div></div>
</div>
</div></div></div>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<br></div></div></div></div></div></div></div>