rebar3_format icon indicating copy to clipboard operation
rebar3_format copied to clipboard

Preserve parentheses on macro usage, not just on macro definition

Open elbrujohalcon opened this issue 4 years ago • 1 comments

There is a problem with parentheses used in macro calls, not only definitions. The default formatter turns…

-define(MUL(A, B), A * B).

?MUL((1 + 2), (3 + 4)).

…into…

-define(MUL(A, B), A * B).

?MUL(1 + 2, 3 + 4).

With parens in the call, it's 21, without them it's 11.

Originally posted by @michalmuskala in https://github.com/AdRoll/rebar3_format/issues/74#issuecomment-730388246

elbrujohalcon avatar Nov 19 '20 13:11 elbrujohalcon

This will probably help: http://erlang.org/doc/man/erl_syntax.html#parentheses-1

elbrujohalcon avatar Feb 18 '21 11:02 elbrujohalcon