Skip to content

Commit 50caa25

Browse files
author
José Valim
committed
Ensure compilation works for a variable named super, closes #9390
1 parent 92af3fd commit 50caa25

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/elixir/src/elixir_erl_pass.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ translate({'__CALLER__', Meta, Atom}, S) when is_atom(Atom) ->
6969
translate({'__STACKTRACE__', Meta, Atom}, S = #elixir_erl{stacktrace={Var, _}}) when is_atom(Atom) ->
7070
{{var, ?ann(Meta), Var}, S#elixir_erl{stacktrace={Var, true}}};
7171

72-
translate({'super', Meta, Args}, S) ->
72+
translate({'super', Meta, Args}, S) when is_list(Args) ->
7373
%% In the expanded AST, super is used to invoke a function
7474
%% in the current module originated from a default clause
7575
%% or a super call.

lib/elixir/test/elixir/kernel/overridable_test.exs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ defmodule Kernel.OverridableTest do
254254
assert Overridable.capture_super_macro(5) == [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]
255255
end
256256

257+
test "super as a variable" do
258+
super = :ok
259+
assert super == :ok
260+
end
261+
257262
test "overridable with many clauses" do
258263
assert Overridable.many_clauses(0) == 11
259264
assert Overridable.many_clauses(1) == 13

0 commit comments

Comments
 (0)