Skip to content

Commit 5b3e13c

Browse files
author
José Valim
committed
Fix overridable tests
1 parent 2021fed commit 5b3e13c

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/elixir/src/elixir_def.erl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ local_for(Module, Name, Arity, Kinds) ->
3434

3535
%% Take a definition out of the table
3636

37-
take_definition(Module, Tuple) ->
37+
take_definition(Module, {Name, Arity} = Tuple) ->
3838
Table = elixir_module:defs_table(Module),
3939
case ets:take(Table, {def, Tuple}) of
40-
[Result] ->
40+
[{{def, Tuple}, _, _, _, _, {Defaults, _, _}} = Result] ->
41+
ets:delete_object(Table, {{default, Name}, Arity, Defaults}),
4142
{Result, [Clause || {_, Clause} <- ets:take(Table, {clauses, Tuple})]};
4243
[] ->
4344
false

lib/elixir/test/elixir/kernel/errors_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ defmodule Kernel.ErrorsTest do
238238

239239
test "different defs with defaults" do
240240
assert_compile_fail CompileError,
241-
"nofile:3: def hello/3 defaults conflicts with def hello/2",
241+
"nofile:3: def hello/3 defaults conflicts with hello/2",
242242
~C'''
243243
defmodule Kernel.ErrorsTest.DifferentDefsWithDefaults1 do
244244
def hello(a, b \\ nil), do: a + b
@@ -247,7 +247,7 @@ defmodule Kernel.ErrorsTest do
247247
'''
248248

249249
assert_compile_fail CompileError,
250-
"nofile:3: def hello/2 conflicts with defaults from def hello/3",
250+
"nofile:3: def hello/2 conflicts with defaults from hello/3",
251251
~C'''
252252
defmodule Kernel.ErrorsTest.DifferentDefsWithDefaults2 do
253253
def hello(a, b \\ nil, c \\ nil), do: a + b + c

0 commit comments

Comments
 (0)