Minor bug: reformats `|> then(&(-&1))` to invalid code
Closed this issue · 1 comments
kerryb commented
Versions
- Elixir: Elixir 1.16.0 (compiled with Erlang/OTP 26)
- Styler: locked at 0.11.8 (styler) fa75e712
A fairly obscure edge case, but …
Example Input
def foo(arg) do
arg
|> bar()
|> baz()
# Negate the value returned from the pipeline
|> then(&(-&1))
end
Stacktrace / Current Behaviour
Reformats to:
def foo(arg) do
arg
|> bar()
|> baz()
# Negate the value returned from the pipeline
|> -()
end
But -(arg)
is invalid syntax, so it needs to be:
def foo(arg) do
arg
|> bar()
|> baz()
# Negate the value returned from the pipeline
|> Kernel.-()
end
Thanks again for this tool, and keep up the good work – the novelty of being able to just throw pipelines, aliases, imports etc in wherever and have them tidied up on save still hasn’t worn off :-)
novaugust commented
thanks as always for being styler's canary kerry :)