rebar3_format
rebar3_format copied to clipboard
Using a macro as an attribute name crashes the formatter
This is the nasty case…
-define(attrib, some_attrib).
-?attrib([foo2/2]).
Which produces an error:
{function_clause,
[{erl_recomment,leaf_node_value,
[{tree,10,10,macro,
{attr,10,[],none},
[],[],
[{list,10,10,
[{leaf,10,10,[],[],
{tree,atom,{attr,10,[],none},attrib}}]}]}],
[{file,"erl_recomment.erl"},{line,711}]},
{erl_recomment,check_file_attr_1,2,
[{file,"erl_recomment.erl"},{line,282}]},
{erl_recomment,filter_forms,3,[{file,"erl_recomment.erl"},{line,229}]},
{erl_recomment,filter_forms,3,[{file,"erl_recomment.erl"},{line,253}]},
{erl_recomment,recomment_forms,3,[{file,"erl_recomment.erl"},{line,136}]},
{rebar3_formatter,format,4,
[{file,
"/Users/fernandobenavides/Projects/Semantic-Sugar/rebar3_format/src/rebar3_formatter.erl"},
{line,54}]},
{lists,foreach,2,[{file,"lists.erl"},{line,1338}]},
{rebar3_format_prv,format,2,
[{file,
"/Users/fernandobenavides/Projects/Semantic-Sugar/rebar3_format/src/rebar3_format_prv.erl"},
{line,76}]}]}
Originally posted by @elbrujohalcon in https://github.com/AdRoll/rebar3_format/issues/22#issuecomment-553853022
This is something that OTP's erl_reconnect
doesn't support either.
We're not going to be able to solve this issue until they don't fix it there.
And that's not going to happen anytime soon…
https://github.com/AdRoll/rebar3_format/issues/22#issuecomment-775993931