[erlang-questions] Dialyzer and how it handles lists in R12B4

Kostis Sagonas kostis@REDACTED
Sun Nov 16 12:17:42 CET 2008


Foolish Ewe wrote:
> Hello All:
> 
> I appreciate the recent help I've received on the dialyzer.
> 
> I'm using the dialyzer from the R12B4 distribution ... DELETED
> I've got two recurring dialyzer complaints (they look similar)
> The dialyzer complaints in my test case read:
> test.erl:213: Type specification 
> test:public_share_matches_coefficients/3 :: 
> (Parameters::#feldman_vss_parameters{},PublicShare::#feldman_vss_public_share{},CoefficientWitnesses::[non_neg_integer()]) 
> -> bool() is a supertype of the success typing: 
> (#feldman_vss_parameters{},#feldman_vss_public_share{},[non_neg_integer(),...]) 
> -> bool()

I think you are making a simple issue a bigger deal than it needs to be.

Dialyzer is simply telling you that the third argument of this function 
is a non-empty list.  The proper action here is to simply take the 
',...' part of the message and place it in the spec of the file.  Then 
the warnings will automagically disappear.

> More information could be made available if needed.  I would like to know:
> 1) Am I right that the dialyzer thinks that these functions need 
> non-empty lists?

Yes you are right.

> 2) Why would the dialyzer think that?

Because it does sophisticated analysis of the code ;-)

> 3) What can I do to get information out of the dialyzer to get a better 
> hint as to why it thinks that?

Unfortunately, nothing for the time being.  Your only option is to stare 
at your code and see how you are using the 3rd argument 
(CoefficientWitnesses) of your function.  Most probably all calls to the 
public_share_matches_coefficients/3 function are with non-empty lists in 
the third argument, or the remaining functions in this module where this 
argument is passed (e.g. the function compute_witness_check_value/5) 
only work with non-empty lists.

Kostis



More information about the erlang-questions mailing list