Skip to content

Commit

Permalink
Ensure compilation works for a variable named super, closes #9390
Browse files Browse the repository at this point in the history
  • Loading branch information
José Valim committed Oct 9, 2019
1 parent c5e3480 commit f52f2c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/elixir/src/elixir_erl_pass.erl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ translate({'__CALLER__', Meta, Atom}, S) when is_atom(Atom) ->
translate({'__STACKTRACE__', Meta, Atom}, S = #elixir_erl{stacktrace={Var, _}}) when is_atom(Atom) ->
{{var, ?ann(Meta), Var}, S#elixir_erl{stacktrace={Var, true}}};

translate({'super', Meta, Args}, S) ->
translate({'super', Meta, Args}, S) when is_list(Args) ->
%% In the expanded AST, super is used to invoke a function
%% in the current module originated from a default clause
%% or a super call.
Expand Down
5 changes: 5 additions & 0 deletions lib/elixir/test/elixir/kernel/overridable_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ defmodule Kernel.OverridableTest do
assert Overridable.capture_super_macro(5) == [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
end

test "super as a variable" do
super = :ok
assert super == :ok
end

test "overridable with many clauses" do
assert Overridable.many_clauses(0) == 11
assert Overridable.many_clauses(1) == 13
Expand Down

0 comments on commit f52f2c7

Please sign in to comment.