-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Closed
Description
We're generating code for compiling strings using EEx and URL-encoding them. Right at the end we're using Macro.prewalk + Macro.expand on the generated quoted expression.
defmodule ItBreaks do
defp compile(param) do
quoted =
quote do
unquote(EEx.compile_string(param |> to_string))
|> URI.encode()
end
{:ok, quoted |> Macro.prewalk(&Macro.expand(&1, __ENV__))}
end
def break do
compile("test")
end
end
This works fine in Elixir 1.10 but breaks with the following error on 1.11:
iex(1)> ItBreaks.break
** (ArgumentError) argument error
(stdlib 3.13.2) :ets.member(Mix.Compilers.ApplicationTracer, Kernel)
(mix 1.11.1) lib/mix/compilers/application_tracer.ex:31: Mix.Compilers.ApplicationTracer.trace/2
(elixir 1.11.1) src/elixir_env.erl:36: :elixir_env."-trace/2-lc$^0/1-0-"/3
(elixir 1.11.1) src/elixir_env.erl:36: :elixir_env.trace/2
(elixir 1.11.1) src/elixir_dispatch.erl:189: :elixir_dispatch.expand_require/5
(elixir 1.11.1) src/elixir_dispatch.erl:170: :elixir_dispatch.do_expand_import/6
(elixir 1.11.1) lib/macro.ex:1437: Macro.do_expand_once/2
(elixir 1.11.1) lib/macro.ex:1559: Macro.expand_until/2
Maybe related to #10271? Without adding the URI.encode part the code works.
Environment
- Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 23 [erts-11.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.11.1 (compiled with Erlang/OTP 23)
- Operating system:
macOS 10.15.7
Metadata
Metadata
Assignees
Labels
No labels