Skip to content

Commit a963269

Browse files
author
José Valim
committed
Fix a bug on Module.to_binary(Elixir), closes #920
1 parent 0463407 commit a963269

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/elixir/lib/module.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ defmodule Module do
527527
@doc """
528528
Convert a module name to binary without the Elixir prefix.
529529
"""
530+
def to_binary(Elixir), do: "Elixir"
531+
530532
def to_binary(module) do
531533
"Elixir-" <> rest = Binary.Chars.to_binary(module)
532534
bc <<r>> inbits rest, do: <<to_dot(r)>>

lib/elixir/test/elixir/module_test.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ defmodule ModuleTest do
178178
end
179179

180180
test :to_binary do
181+
assert Module.to_binary(Elixir) == "Elixir"
181182
assert Module.to_binary(Hello.World) == "Hello.World"
182183
end
183184

0 commit comments

Comments
 (0)