[erlang-questions] Force TLS v1.2

WW kingwang98@REDACTED
Sat Apr 27 12:43:29 CEST 2019

But according to spec   the input of the function can be any()! It is obvious the _E  should be considered, otherwise erlang will crash.
Am I wrong? 
Best Regards W.W.(KingWang) 

    On Saturday, April 27, 2019, 12:30:21 PM GMT+2, Kostis Sagonas <kostis@REDACTED> wrote:  
 On 4/26/19 3:34 PM, WW wrote:
> Dialyzer warning if not export my function convert_result_and_exit/1
> %%% 
> ###=====================================================================###
> -spec convert_result_and_exit(any()) -> no_return().
> %%% 
> ###=====================================================================###
> convert_result_and_exit({error, ErrReason}) when is_binary(ErrReason)-> 
> exit({error, ErrReason});
> convert_result_and_exit(no_permission)-> exit(no_permission);
> convert_result_and_exit(_E) -> exit({error, <<"Unknown reason">>}).
> got a warning from dialyzer:
> 1569: The variable _E can never match since previous clauses completely 
> covered the type 'no_permission' | {'error',binary()}
> Anybody has an explanation why ?

Because all calls to convert_result_and_exit/1 are either with an 
{'error',binary()} tuple or the 'no_permission' atom.  Thus, Dialyzer 
can figure out that the third clause is unreachable and informs you 
about it.

Effectively, it tells you that you have either made a mistake somewhere 
and you have no call with something other than 'no_permission' | 
{'error',binary()} or you can remove this clause (comment it out).

Once you have done that, perhaps you may also want to strengthen the 
spec of the function.

> Dialyzer   bug ?

Remember the slogan: "Dialyzer is never wrong!"

erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190427/1dae1ae3/attachment.htm>

More information about the erlang-questions mailing list