Re: Dialyzer can't compile map correctly

Kostis Sagonas <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
On 12/16/2014 01:07 AM, Jesper Louis Andersen wrote:
> Hi OTP team and other interested parties.
>
> While I was building up the enacl application, I have discovered a
> problem where I can crash the dialyzer.

Dialyzer should of course not crash and should be fixed, but your 
program is crap and dialyzer (rightfully) throws up on such code ;)

It's caused by the following two functions which make the 
crypto_box_keypair/0 function not returning:

not_loaded() ->
     error({nif_not_loaded, ?MODULE}).

crypto_box_keypair() -> not_loaded().


So your use of the call to enacl_nif:crypto_box_keypair() in the enacl 
module makes Dialyzer think that the particular call will not return. 
Thus, the -spec box_keypair() -> #{ atom() => binary() }. that you have 
specified is wrong as far as Dialyzer is concerned.  It crashes when in 
the phase that it tries to generate the warning.  Dialyzer should of 
course be fixed so that its analysis does not crash when generating 
warnings for specs that contain (erroneous) map types, but this will not 
fix the problem(s) in your code base.

Kostis
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.