Skip to content

Commit e412ce6

Browse files
author
José Valim
committed
Can defined a nested module called Elixir, closes #858
1 parent e01f958 commit e412ce6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/elixir/src/elixir_macros.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ rewrite_case_clauses(Clauses) ->
321321
expand_module(Raw, Module, #elixir_scope{module=Nesting}) when is_atom(Raw); Nesting == nil ->
322322
Module;
323323

324-
expand_module({ '__aliases__', _, _ } = Alias, Module, S) ->
324+
expand_module({ '__aliases__', _, List } = Alias, Module, S) when List /= ['Elixir'] ->
325325
case elixir_aliases:expand(Alias, S#elixir_scope.aliases, S#elixir_scope.macro_aliases) of
326326
Atom when is_atom(Atom) ->
327327
Module;

lib/elixir/test/elixir/kernel/alias_test.exs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ defmodule Kernel.AliasTest do
2626
alias List, as: Nested
2727
assert Nested.flatten([[13]]) == [13]
2828
end
29+
30+
defmodule Elixir do
31+
def sample, do: 1
32+
end
33+
34+
test :nested_elixir_alias do
35+
assert Kernel.AliasTest.Elixir.sample == 1
36+
end
2937
end
3038

3139
defmodule Kernel.AliasNestingGenerator do

0 commit comments

Comments
 (0)