[erlang-bugs] dialyzer: false function has no local return warning in R14B?

Klas Johansson <>
Thu Nov 4 23:20:59 CET 2010


On Thu, Nov 4, 2010 at 11:22 PM, Kostis Sagonas <> wrote:
> Klas Johansson wrote:
>>
>> Hi,
>>
>> I get a warning from dialyzer when using ets:select (test case
>> attached), but it seems like a false warning.  The fact that the key
>> (#r.k) is a tuple rather than an atom seems important - there's no
>> warning if it's an atom.
>>
>> This is on R14B (as well as earlier versions).
>>
>> Any ideas?
>
> You are sort of right that this is related to the declaration of #r{} and
> its fields. But this is not a dialyzer bug!
>
> Instead, it's a bug in the ms_transform parse transformation which is not
> aware of type declarations in records and messes up things.
>
> To verify that this is the case either comment out the line:
>
> -include_lib("stdlib/include/ms_transform.hrl").
>
> which enables the parse transform, or simply take out the type declaration
> from the record.  Dialyzer will then like your module :-)
>
> I am leaving this to the person responsible for the ms parse transform to
> fix.

Ah, I see what's happening here.  The parse transform generates this
match specification for me:

    [{{r,'_'},[],['$_']}]    which is the same as    [{#r{_='_'},[],['$_']}]

... but this doesn't match the type specs ('_' is an atom, not a tuple):

    -type k() :: {term(), term()}.
    -record(r, {k :: k()}).

Tricky.  Thanks for your help.


BR,
Klas


More information about the erlang-bugs mailing list