Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when using sigils in ignored expressions #363

Open
eproxus opened this issue Sep 17, 2024 · 1 comment
Open

Crash when using sigils in ignored expressions #363

eproxus opened this issue Sep 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@eproxus
Copy link

eproxus commented Sep 17, 2024

When using sigils in ignored expressions, erlfmt crashes. The following module:

-module(sigil).
-export([f/0]).
% erlfmt:ignore
f() -> ~"foo".

will crash with the following error:

$ rebar3 fmt
rebar3 fmt Internal Error
exit:{badarg,[{erlang,'++',
                      [undefined,"}.\n"],
                      [{error_info,#{module => erl_erts_errors}}]},
              {lists,flatmap_1,2,[{file,"lists.erl"},{line,2116}]},
              {lists,flatmap_1,2,[{file,"lists.erl"},{line,2116}]},
              {erlfmt_scan,last_node_string_trimmed,1,
                           [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt_scan.erl"},
                            {line,200}]},
              {erlfmt,node_string,1,
                      [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt.erl"},
                       {line,597}]},
              {erlfmt,parse_node,6,
                      [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt.erl"},
                       {line,525}]},
              {erlfmt,read_nodes_loop,5,
                      [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt.erl"},
                       {line,499}]},
              {erlfmt,read_file,2,
                      [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt.erl"},
                       {line,408}]}]}
[{erlfmt_cli,parallel_loop,5,
             [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,509}]},
 {erlfmt_cli,unprotected_with_config,2,
             [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,148}]},
 {erlfmt_cli,with_parsed,2,
             [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/erlfmt_cli.erl"},
              {line,103}]},
 {rebar3_fmt_prv,do,1,
                 [{file,"/Users/user/Developer/Code/build/default/plugins/erlfmt/src/rebar3_fmt_prv.erl"},
                  {line,43}]},
 {rebar_core,do,2,
             [{file,"/private/var/folders/lg/pnq7gqs91d7fh08tyb2jlwth0000gn/T/rebar3-3.24.0/apps/rebar/src/rebar_core.erl"},
              {line,155}]},
 {rebar3,run_aux,2,
         [{file,"/private/var/folders/lg/pnq7gqs91d7fh08tyb2jlwth0000gn/T/rebar3-3.24.0/apps/rebar/src/rebar3.erl"},
          {line,205}]},
 {rebar3,main,1,
         [{file,"/private/var/folders/lg/pnq7gqs91d7fh08tyb2jlwth0000gn/T/rebar3-3.24.0/apps/rebar/src/rebar3.erl"},
          {line,66}]},
 {escript,run,2,[{file,"escript.erl"},{line,904}]}]

Without the ignore, the formatting works fine.

@michalmuskala michalmuskala added the bug Something isn't working label Sep 17, 2024
@michalmuskala
Copy link
Member

Thank you, I'll take a look, though this might be only next week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants