New analysis case for Dialyzer ?

Bjorn Gustavsson bjorn@REDACTED
Mon Apr 11 11:44:42 CEST 2005


Tobias Lindahl <tobias.lindahl@REDACTED> writes:
[...]

> In
> 
> > *   TS = To#psock.s,
> 
> the problem is that accessing a field of a record using the .-notation is
> not a guarantee that the variable is an instance of the record. It
> compiles in the same way as erlang:element/2, so the only limitation on TO
> in your example is that it is a tuple and that it is sufficiently big to
> take the element corresponding to the record field s from it.

We plan to eventually change that, so that there will be a proper record
test when "." to access elements. I am not sure we will have time to do that
for R11B, though.

> 
> The type signature of erlang:send/2 (or !) is:
> 
> send(pid() | port() | atom() | {atom(), atom()}, any()) -> any()
> 
> The information that the first operand is a tuple will not yield a
> discrepancy report, since it might succeed. (If something can succeed
> Dialyzer currently reports nothing to avoid false positives.)

It could generate a report if the tuple is known to have a size larger
than 2 (unless the 's' element happens to be the first in the record,
the tuple has more than 2 elements).

/Bjorn

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list