erlfmt
erlfmt copied to clipboard
Formatting fails with binary pattern match macro
When formatting a module containing a macro with an argument that is put inside a binary, a compilation error is generated:
-module(my_module).
-export([func/2]).
-define(BIN(Arg), <<Arg>>).
func(uuid, ?BIN(A:8)) -> A.
Running rebar3 fmt
on this file generates the following error:
$ rebar3 fmt src/my_module.erl
===> Analyzing applications...
===> Compiling erlfmt
src/my_module.erl:7:18: syntax error before: ':'
Erlang / Rebar 3 itself can compile the file just fine:
$ rebar3 shell
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling my_app
Erlang/OTP 27 [erts-15.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Eshell V15.0.1 (press Ctrl+G to abort, type help(). for help)
1> my_module:func(<<"A">>).
65
erlfmt
version: 1.3.0
and latest main
Erlang/OTP: 27.0.1
Rebar 3: 3.23.0