[erlang-questions] 12B4 dialyzer problem 2

Tobias Lindahl <>
Thu Sep 11 12:55:56 CEST 2008

Hi Anthony,

Anthony Shipman wrote:
> It appears that dialyzer can't prove that the parent and strmID fields can 
> never be undefined. This isn't surprising. But I expected that dialyzer would 
> accept the declaration
> 	parent:: pid(),
> to tell it that the field is never undefined.

Currently, the only way to say that a field cannot contain 'undefined' 
is to have a default value in the record declaration. The reason is that 
  all record constructions must follow the type declarations, and if you 
construct an empty record without a default value the type must also 
allow 'undefied'.

> If I am going to get this problem everywhere I use this basic gen_server idiom 
> then dialyzer is going to give me lots and lots of false negatives.

If Dialyzer reports a false positive, then this is a bug. You do not 
include the contract for streamIface:specialToDevice/3, so I can't 
determine if it is a false positive. Dialyzer should not complain unless 
one of the arguments is _totally_ incompatible with the contract, i.e., 
the argument type and the contract type has no intersection.


More information about the erlang-questions mailing list