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

Invalid formatting of ! when restructuring a pipe #183

Closed
nherzing opened this issue Jul 2, 2024 · 1 comment
Closed

Invalid formatting of ! when restructuring a pipe #183

nherzing opened this issue Jul 2, 2024 · 1 comment

Comments

@nherzing
Copy link

nherzing commented Jul 2, 2024

Versions

  • Elixir: Elixir 1.17.0 (compiled with Erlang/OTP 26)
  • Styler: locked at 1.0.0-rc.2 (styler) 35f8f0ec

Example Input

!is_number(42) |> IO.puts()

Stacktrace / Current Behaviour

This code is formatted as

42 |> is_number() |> !() |> IO.puts()

which is not going to evaluate. Attempting to run this formatted code results in

** (ArgumentError) cannot pipe 42 |> is_number() into !nil, the :! operator can only take one argument
    (elixir 1.17.0) lib/macro.ex:318: Macro.pipe/3
    (stdlib 5.2) lists.erl:1594: :lists.foldl/3
    (elixir 1.17.0) expanding macro: Kernel.|>/2
    iex:1: (file)
    (elixir 1.17.0) expanding macro: Kernel.|>/2
    iex:1: (file)
@novaugust
Copy link
Contributor

thanks for the issue & repro! i'll make sure styler knows to add a Kernel. in front of that !. not the prettiest solution, but sometimes things look sad when there are strict rules :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants