[erlang-bugs] illegal declaration of pertially defined record types in dialyzer, R14A

Kostis Sagonas <>
Tue Aug 31 15:48:50 CEST 2010

Nico Kruber wrote:
> here's the other bug I originally intendet to report:
> I declare a remote type rec1:rec1() in the rec1 module,
> a record rec2 in module rec2 along with a rec2:rec2() type.
> If I use the rec2:rec2() type in a third module, i.e. rec3, dialyzer reports 
> an illegal declaration of rec2#{id}:

There is probably something that needs improvement (or fine tuning) in 
dialyzer, but what you are doing below is totally unnecessary:

-record(rec2, {id::rec1:rec1(), pid::pid()}).
-type(rec2() :: #rec2{id::rec1:rec1(), pid::pid()}).

Here you declare a typed record and in the next line you duplicate the 
declaration of the types of its fields.  There is no real reason to do this.

Simply change the type declaration to the following equivalent one:

-type(rec2() :: #rec{}).

and the problem you reported will go away.


More information about the erlang-bugs mailing list