Skip to content

Styler 0.11.2 locks up when encountering @spec or @callback for a function called ‘import’ #115

@kerryb

Description

@kerryb

Versions

  • Elixir: Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]; Elixir 1.16.0 (compiled with Erlang/OTP 26)
  • Styler: locked at 0.11.2 (styler) 363f4124

Example Input

defmodule Foo do
  @spec import(any(), any(), any()) :: any()
  def import(a, b, c), do: nil
end

Stacktrace / Current Behaviour

mix format foo.ex locks up and never completes.

This is new in 0.11.2, and wasn’t an issue in 0.11.1. Having finally narrowed it down from “formatting the whole project locks up” to realising it was the function name, I appreciate that calling an elixir function import is probably not a great idea. The built-in import/2 is a Kernel function rather than a reserved word though, so it is valid. At least I can easily get my project formatting again by just choosing a better name :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions