[erlang-questions] Force TLS v1.2
Kostis Sagonas
kostis@REDACTED
Sat Apr 27 12:32:18 CEST 2019
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!"
Kostis
More information about the erlang-questions
mailing list