Skip to content

Commit e3fc947

Browse files
committed
Pass the relevant module when generating unique vars for guards
1 parent 0909940 commit e3fc947

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/elixir/lib/kernel/utils.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ defmodule Kernel.Utils do
331331
quote do
332332
case Macro.Env.in_guard?(__CALLER__) do
333333
true -> unquote(literal_quote(unquote_every_ref(expr, vars)))
334-
false -> unquote(literal_quote(unquote_refs_once(expr, vars)))
334+
false -> unquote(literal_quote(unquote_refs_once(expr, vars, env.module)))
335335
end
336336
end
337337
end
@@ -361,7 +361,7 @@ defmodule Kernel.Utils do
361361
end
362362

363363
# Prefaces `guard` with unquoted versions of `refs`.
364-
defp unquote_refs_once(guard, refs) do
364+
defp unquote_refs_once(guard, refs, module) do
365365
{guard, used_refs} =
366366
Macro.postwalk(guard, %{}, fn
367367
{ref, meta, context} = var, acc when is_atom(ref) and is_atom(context) ->
@@ -375,7 +375,7 @@ defmodule Kernel.Utils do
375375

376376
%{} ->
377377
generated = String.to_atom("arg" <> Integer.to_string(map_size(acc) + 1))
378-
new_var = Macro.unique_var(generated, Elixir)
378+
new_var = Macro.unique_var(generated, module)
379379
{new_var, Map.put(acc, pair, {new_var, var})}
380380
end
381381

0 commit comments

Comments
 (0)