[erlang-questions] internal error in lint_module

Xiao Jia <>
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,
                                 [line,function,#Fun<erl_lint.9.103090672>],
                                 [{file,"erl_scan.erl"},{line,418}]},
...
(see https://gist.github.com/stfairy/8471800 for full error)


File z.erl:


-module(z).
-compile({parse_transform, zt}).
-export([f/1]).
f(_) -> z.


File zt.erl:


-module(zt).
-export([parse_transform/2]).

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
    end;
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"...


-- 
Regards,
Xiao Jia



More information about the erlang-questions mailing list