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

Styler fails on function header without parameters #185

Closed
ypconstante opened this issue Aug 6, 2024 · 1 comment
Closed

Styler fails on function header without parameters #185

ypconstante opened this issue Aug 6, 2024 · 1 comment

Comments

@ypconstante
Copy link

Styler fails to get the line ending for a function header without parameters.
In my code I'm using using this function header because the behavior callback implementation will be added on @before_compile, and to avoid a compilation warning I have to add this function header.

Versions

  • Elixir: Elixir 1.16.2 (compiled with Erlang/OTP 26)
  • Styler: 1.0.0-rc.2

Example Input

defmodule Example do
  @callback list() :: any()

  defmacro __using__(_) do
    quote do
      @behaviour Example

      @impl Example
      def list
    end
  end
end

Stacktrace / Current Behaviour

** (Styler.StyleError) Error running style Defs on lib/example.ex
   Please consider opening an issue at: https://github.com/adobe/elixir-styler/issues/new
** (ArgumentError) ranges (first..last) expect both sides to be integers, got: 9..nil

    (elixir 1.16.2) lib/range.ex:193: Range.new/2
    (styler 1.0.0-rc.2) lib/style/defs.ex:59: Styler.Style.Defs.run/2
    (styler 1.0.0-rc.2) lib/zipper.ex:386: Styler.Zipper.do_traverse_while/3
    (styler 1.0.0-rc.2) lib/styler.ex:42: anonymous fn/4 in Styler.style/3
    (elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
    (styler 1.0.0-rc.2) lib/styler.ex:38: Styler.style/3
    (styler 1.0.0-rc.2) lib/styler.ex:72: Styler.format/2
    (elixir 1.16.2) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
@novaugust
Copy link
Contributor

thanks for the report =)

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