<html><head></head><body><div class="ydpc93bce6dyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:10px;"><div><div>But according to spec   the input of the function can be any()! It is obvious the _E  should be considered, otherwise erlang will crash.</div><div><br></div><div>Am I wrong? </div><div><br></div><div class="ydpc93bce6dsignature">Best Regards
 W.W.(KingWang)</div></div>
        <div><br></div><div><br></div>
        
        </div><div id="yahoo_quoted_6569487903" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                    On Saturday, April 27, 2019, 12:30:21 PM GMT+2, Kostis Sagonas <kostis@cs.ntua.gr> wrote:
                </div>
                <div><br></div>
                <div><br></div>
                <div><div dir="ltr">On 4/26/19 3:34 PM, WW wrote:<br clear="none">> Dialyzer warning if not export my function convert_result_and_exit/1<br clear="none">> <br clear="none">> <br clear="none">> %%% <br clear="none">> ###=====================================================================###<br clear="none">> -spec convert_result_and_exit(any()) -> no_return().<br clear="none">> %%% <br clear="none">> ###=====================================================================###<br clear="none">> convert_result_and_exit({error, ErrReason}) when is_binary(ErrReason)-> <br clear="none">> exit({error, ErrReason});<br clear="none">> convert_result_and_exit(no_permission)-> exit(no_permission);<br clear="none">> convert_result_and_exit(_E) -> exit({error, <<"Unknown reason">>}).<br clear="none">> <br clear="none">> <br clear="none">> got a warning from dialyzer:<br clear="none">> <br clear="none">> 1569: The variable _E can never match since previous clauses completely <br clear="none">> covered the type 'no_permission' | {'error',binary()}<br clear="none">> <br clear="none">> Anybody has an explanation why ?<br clear="none"><br clear="none">Because all calls to convert_result_and_exit/1 are either with an <br clear="none">{'error',binary()} tuple or the 'no_permission' atom.  Thus, Dialyzer <br clear="none">can figure out that the third clause is unreachable and informs you <br clear="none">about it.<br clear="none"><br clear="none">Effectively, it tells you that you have either made a mistake somewhere <br clear="none">and you have no call with something other than 'no_permission' | <br clear="none">{'error',binary()} or you can remove this clause (comment it out).<br clear="none"><br clear="none">Once you have done that, perhaps you may also want to strengthen the <br clear="none">spec of the function.<br clear="none"><br clear="none">> Dialyzer   bug ?<br clear="none"><br clear="none">Remember the slogan: "Dialyzer is never wrong!"<br clear="none"><br clear="none">Kostis<div class="yqt5149548843" id="yqtfd36819"><br clear="none">_______________________________________________<br clear="none">erlang-questions mailing list<br clear="none"><a shape="rect" ymailto="mailto:erlang-questions@erlang.org" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br clear="none"><a shape="rect" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br clear="none"></div></div></div>
            </div>
        </div></body></html>