Skip to content

Commit 5bde00a

Browse files
author
José Valim
committed
Properly expand var! second argument
1 parent 9a62a43 commit 5bde00a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/elixir/src/elixir_translator.erl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -524,17 +524,13 @@ translate_local(Meta, Name, Args, S) ->
524524
{ { call, Line, Remote, TArgs }, NS }.
525525

526526
expand_var_context(_Meta, Atom, _Msg, _S) when is_atom(Atom) -> Atom;
527-
528-
expand_var_context(Meta, { '__aliases__', _, _ } = Alias, Msg, S) ->
527+
expand_var_context(Meta, Alias, Msg, S) ->
529528
case translate_each(Alias, S) of
530529
{ { atom, _, Atom }, _ } ->
531530
Atom;
532531
_ ->
533-
syntax_error(Meta, S#elixir_scope.file, "~ts, expected a compile time available alias", [Msg])
534-
end;
535-
536-
expand_var_context(Meta, _, Msg, S) ->
537-
syntax_error(Meta, S#elixir_scope.file, "~ts, expected an atom or an alias", [Msg]).
532+
syntax_error(Meta, S#elixir_scope.file, "~ts, expected a compile time available alias or an atom", [Msg])
533+
end.
538534

539535
%% Translate args
540536

lib/elixir/test/elixir/kernel/quote_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ defmodule Kernel.QuoteTest.VarHygieneTest do
106106
end
107107

108108
defmacrop read_cross_module do
109-
quote do: a
109+
quote do: var!(a, __MODULE__)
110110
end
111111

112112
test :no_interference do

0 commit comments

Comments
 (0)