[erlang-bugs] erl_pp having problems with typed record defs
Robert Virding
robert.virding@REDACTED
Sun Oct 23 15:46:12 CEST 2011
Don't use types. :-)
Robert
----- Original Message -----
>
> 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
>
>
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
More information about the erlang-bugs
mailing list