[erlang-questions] internal error in lint_module

Xiao Jia me@REDACTED
Fri Jan 17 12:56:42 CET 2014

(I posted this to erlang-bugs as well, but it may deserve some
discussions here.)

I was writing a parse_transform module using erl_syntax_lib:mapfold,
but both R16B03 and R15B03-1 give the following error even if the
parse_transform module does nothing:

z.erl:none: internal error in lint_module;
crash reason: {badarg,[{erl_scan,set_attr,
(see https://gist.github.com/stfairy/8471800 for full error)

File z.erl:

-compile({parse_transform, zt}).
f(_) -> z.

File zt.erl:


parse_transform(AST, _Options) ->
    [parse(T) || T <- AST].

parse({function, _, _, _, _} = T) ->
    case erl_syntax_lib:mapfold(fun foobar/2, something, T) of
        {T1, _} -> T1;
        _ -> T
parse(T) -> T.

foobar(T, S) -> {T, S}.

$ erlc zt.erl
$ erlc -pa . z.erl

btw, I am a little confused why parse_transform modules are usually
named as "zt"...

Xiao Jia

More information about the erlang-questions mailing list