Skip to content

Commit 69a4138

Browse files
author
José Valim
committed
Remove remaining function implementation from access protocol old versions
1 parent 0fa06a2 commit 69a4138

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

lib/elixir/lib/access.ex

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ defprotocol Access do
1111
following built-in types: keywords, records and functions.
1212
"""
1313

14-
@only [List, Function, Record, Atom]
14+
@only [List, Record, Atom]
1515

1616
@doc """
1717
Receives the element being accessed and the access item.
@@ -53,20 +53,9 @@ defimpl Access, for: Atom do
5353
def access(nil, _) do
5454
nil
5555
end
56+
5657
def access(atom, _) do
5758
raise "The access protocol can only be invoked for atoms at " <>
5859
"compilation time, tried to invoke it for #{inspect atom}"
5960
end
6061
end
61-
62-
defimpl Access, for: Function do
63-
@doc """
64-
The Access protocol for functions simply invokes
65-
the function passing the item as argument. This
66-
is useful because it allows a function to be
67-
passed as argument in places a dict would also fit.
68-
"""
69-
def access(function, item) do
70-
function.(item)
71-
end
72-
end

lib/elixir/test/elixir/access_test.exs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ defmodule AccessTest do
1313
assert nil[:foo] == nil
1414
end
1515

16-
test :function do
17-
function = fn x -> x == :foo end
18-
assert function[:foo] == true
19-
assert function[:bar] == false
20-
end
21-
2216
# Test nil at compilation time does not fail
2317
# and that @config[:foo] has proper precedence.
2418
nil = @config[:foo]

0 commit comments

Comments
 (0)