Skip to content

Commit a77445c

Browse files
author
José Valim
committed
Revert "Fix errors with ref/4 IEx helper (#8016)"
This reverts commit b9d6f4f.
1 parent 4d55fa6 commit a77445c

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,34 +1204,25 @@ defmodule IEx.Helpers do
12041204
12051205
## Examples
12061206
1207-
iex> ref("0.1.2.3")
1208-
#Reference<0.1.2.3>
1207+
iex> ref("0.21.32.43")
1208+
#Reference<0.21.32.43>
12091209
12101210
"""
12111211
@doc since: "1.6.0"
12121212
def ref(string) when is_binary(string) do
12131213
:erlang.list_to_ref('#Ref<#{string}>')
12141214
end
12151215

1216-
@doc """
1217-
Creates a Reference from its 4 non-negative integers components.
1218-
1219-
## Examples
1220-
1221-
iex> ref(0, 1, 2, 3)
1222-
#Reference<0.1.2.3>
1223-
1224-
"""
12251216
@doc since: "1.6.0"
12261217
def ref(w, x, y, z)
12271218
when is_integer(w) and w >= 0 and is_integer(x) and x >= 0 and is_integer(y) and y >= 0 and
12281219
is_integer(z) and z >= 0 do
12291220
:erlang.list_to_ref(
1230-
'#Ref<' ++
1221+
'<' ++
12311222
Integer.to_charlist(w) ++
12321223
'.' ++
12331224
Integer.to_charlist(x) ++
1234-
'.' ++ Integer.to_charlist(y) ++ '.' ++ Integer.to_charlist(z) ++ '>'
1225+
'.' ++ '.' ++ Integer.to_charlist(y) ++ '.' ++ '.' ++ Integer.to_charlist(z) ++ '.' ++ '>'
12351226
)
12361227
end
12371228

lib/iex/test/iex/helpers_test.exs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,26 +1090,6 @@ defmodule IEx.HelpersTest do
10901090
end
10911091
end
10921092

1093-
describe "ref" do
1094-
test "builds a ref from string" do
1095-
assert inspect(ref("0.419006.1377304581.1")) == "#Reference<0.419006.1377304581.1>"
1096-
assert inspect(ref("0.1.2.3")) == "#Reference<0.1.2.3>"
1097-
1098-
assert_raise ArgumentError, fn ->
1099-
ref("0.6.6.-6")
1100-
end
1101-
end
1102-
1103-
test "builds a ref from integers" do
1104-
assert inspect(ref(0, 419_006, 1_377_304_581, 1)) == "#Reference<0.419006.1377304581.1>"
1105-
assert inspect(ref(0, 1, 2, 3)) == "#Reference<0.1.2.3>"
1106-
1107-
assert_raise FunctionClauseError, fn ->
1108-
ref(0, 6, 6, -6)
1109-
end
1110-
end
1111-
end
1112-
11131093
describe "i" do
11141094
test "prints information about the data type" do
11151095
assert capture_io(fn -> i(:ok) end) =~ """

0 commit comments

Comments
 (0)