[erlang-bugs] erl_pp having problems with typed record defs

Ulf Wiger ulf.wiger@REDACTED
Sun Oct 23 14:10:52 CEST 2011


I noticed that erl_pp gets very unhappy with typed records.

Example:

-module(trec).
-export([f/0]).

-record(r, {i = 0 :: integer()}).

f() ->
    #r{}.


uwbook:src uwiger$ erlc -W +debug_info trec.erl
uwbook:src uwiger$ pp trec.beam
-file("./trec.erl", 1).
-module(trec).
-export([f/0]).
-record(r,{i = 0}).
-type {record,r}() ::
          INVALID-FORM:[{typed_record_field,{record_field,4,{atom,4,i},{integer,4,0}},{type,4,integer,[]}}]:.
f() ->
    #r{}.


I'm using OTP R14B04.
alias pp='escript /Users/uwiger/ETC/git/parse_trans/ebin/parse_trans_pp.beam'

where parse_trans_pp basically does:

		   io_lib:fwrite("~s~n", [lists:flatten(
					    [erl_pp:form(Form) ||
						Form <- AC])])

It seems to me as if the issue is that the typed record spec gets broken up in two different forms, and erl_pp:form/1 obviously can't put them together again, as it gets one form at a time.

Any suggestions on how to get around this?

BR,
Ulf W

Ulf Wiger, CTO, Erlang Solutions, Ltd.
http://erlang-solutions.com






More information about the erlang-bugs mailing list