[erlang-bugs] internal error in lint_module

Xiao Jia me@REDACTED
Fri Jan 17 12:44:43 CET 2014


Hi,

I am writing a parse_transform module using erl_syntax_lib:mapfold,
but encountered a mysterious error message:


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}]},
                       {erl_lint,modify_line1,2,
                                 [{file,"erl_lint.erl"},{line,3352}]},
                       {erl_lint,eval_file_attr,2,
                                 [{file,"erl_lint.erl"},{line,650}]},
                       {erl_lint,eval_file_attr,2,
                                 [{file,"erl_lint.erl"},{line,651}]},
                       {erl_lint,eval_file_attr,2,
                                 [{file,"erl_lint.erl"},{line,648}]},
                       {erl_lint,forms,2,[{file,"erl_lint.erl"},{line,608}]},
                       {erl_lint,module,3,[{file,"erl_lint.erl"},{line,472}]},
                       {compile,lint_module,1,
                                [{file,"compile.erl"},{line,912}]}]}


File z.erl:


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

f(_) -> z.


However, this error still occurs even if the module does nothing:


-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}.


The two files are compiled as follows


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


I am using Mac OS 10.9 and installed Erlang via Homebrew.  Both R16B03
and R15B03-1 give this error.
I also created a Gist on GitHub with exactly the same information
listed above.  https://gist.github.com/stfairy/8471800


-- 
Regards,
Xiao Jia



More information about the erlang-bugs mailing list