Skip to content
Permalink
Browse files

Ensure compilation works for a variable named super, closes #9390

  • Loading branch information...
josevalim committed Oct 9, 2019
1 parent c5e3480 commit f52f2c79527f5477a91876536e5f2debbdf0a51d
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/elixir/src/elixir_erl_pass.erl
  2. +5 −0 lib/elixir/test/elixir/kernel/overridable_test.exs
@@ -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.
@@ -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

0 comments on commit f52f2c7

Please sign in to comment.
You can’t perform that action at this time.