$ erlc zt.erl
$ erlc -pa . z.erl
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}]}]}
It is not a bug.
"AST" in parse_transform/2 is a list of abstract forms but the output of erl_syntax_lib:mapfold/3 is a syntax tree (namely, that "T1"), that's why it throws some errors because parse_transform/2 should return a list of abstract forms. You can give a list of syntax trees to erl_syntax:revert_forms/1 to get a list of abstract forms.
-- Sina Samavati
Finally I understand this and use erl_syntax:revert
instead.