<html><head></head><body><div class="ydpab435abfyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div><div>Thank you, Guilhenrme!</div><div><br></div><div>Here is my conclusion:</div><div><br></div><div>For internal function call, we need actually implement to cover all cases specified in the function (missing implementation dialyzer will give warning), however, when exporting that function, dialyzer <span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"> can't determine the full range of possible arguments, so it will not give warning. </span></span></div><div><span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><br></span></span></div><div><span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">solution:  1) Export that function.</span></span></div><div><span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;">                2) Switch off  thedialyzer warning for that function: <span>-dialyzer({nowarn_function, validator/1}).</span><br></span></span></div><div><span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><br></span></span></span></div><div><span><span style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif;"><span><br></span></span></span></div><div><br></div><div class="ydpab435abfsignature">Best regards //Wei. W</div></div><div><br></div>
        
        </div><div id="yahoo_quoted_7058537365" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Sunday, April 28, 2019, 11:19:26 PM GMT+2, Guilherme Andrade <g@gandrade.net> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div id="yiv5427117912"><div><div dir="ltr"><div>Hello Wei,<br clear="none"></div><br clear="none"><div class="yiv5427117912gmail_quote"><div class="yiv5427117912gmail_attr" dir="ltr">On Sun, 28 Apr 2019 at 21:38, WW <<a rel="nofollow" shape="rect" ymailto="mailto:kingwang98@yahoo.com" target="_blank" href="mailto:kingwang98@yahoo.com">kingwang98@yahoo.com</a>> wrote:<br clear="none"></div><blockquote class="yiv5427117912gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><div><div class="yiv5427117912gmail-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 clear="none"></div><div>It means exported function allowing never reach the calls ?</div></div></div></blockquote><div><br clear="none"></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 clear="none"></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.<div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd70215"><br clear="none"></div></div><div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd14092"><div><br clear="none"></div><div> </div></div><blockquote class="yiv5427117912gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"><div><div class="yiv5427117912gmail-m_5123051821897398879yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd68486"><div><br clear="none"></div><div><br clear="none"></div></div><div class="yiv5427117912gmail-m_5123051821897398879yahoo_quoted" id="yiv5427117912gmail-m_5123051821897398879yahoo_quoted_6961022268"><div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd00814">
            </div><div style=""><div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd15729">
                
                <div>
                    On Sunday, April 28, 2019, 9:30:03 PM GMT+2, Kostis Sagonas <<a rel="nofollow" shape="rect" ymailto="mailto:kostis@cs.ntua.gr" target="_blank" href="mailto:kostis@cs.ntua.gr">kostis@cs.ntua.gr</a>> wrote:
                </div>
                <div><br clear="none"></div>
                <div><br clear="none"></div>
                </div><div><div dir="ltr"><div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd08423">On 4/28/19 6:41 PM, WW wrote:<div class="yiv5427117912gmail-m_5123051821897398879yqt8088745832" id="yiv5427117912gmail-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><div class="yiv5427117912gmail-m_5123051821897398879yqt8088745832" id="yiv5427117912gmail-m_5123051821897398879yqtfd21975"><br clear="none"></div></div></div>
            </div>
        </div></div></div>_______________________________________________<br clear="none">
erlang-questions mailing list<br clear="none">
<a rel="nofollow" shape="rect" ymailto="mailto:erlang-questions@erlang.org" target="_blank" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none">
<a rel="nofollow" shape="rect" target="_blank" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none">
</blockquote></div><br clear="all"><br clear="none">-- <br clear="none"><div class="yiv5427117912gmail_signature" dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<div class="yiv5427117912yqt2037213767" id="yiv5427117912yqtfd26280"><br clear="none"></div></div></div></div></div></div></div></div></div></div></div>
            </div>
        </div></body></html>