Skip to content

Compilation error in elixir 1.18.x #232

@cena

Description

@cena

Elixir 1.18.4
Erlang 28

Running make setup generates:


== Compilation error in file lib/school_house_web/plugs/redirect_plug.ex ==
** (ArgumentError) cannot inject attribute @redirects into function/macro because cannot escape #Reference<0.4048174596.2893938689.235081>. The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
    (elixir 1.18.4) lib/kernel.ex:3777: Kernel.do_at_escape/2
    (elixir 1.18.4) expanding macro: Kernel.@/1
    lib/school_house_web/plugs/redirect_plug.ex:30: SchoolHouseWeb.RedirectPlug.redirect_to_path/1

Looks like it's from this update: elixir-lang/elixir#14381

and affects these lines of redirect_plug.ex:

defp redirect_to_path(conn) do
    with {pattern, replacement} <- Enum.find(@redirects, &path_matcher(&1, conn.request_path)) do
      Regex.replace(pattern, conn.request_path, replacement)
    end
  end

  defp path_matcher({pattern, _replacement}, request_path), do: Regex.match?(pattern, request_path)
end

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