File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -602,7 +602,7 @@ defmodule Code do
602602 "Converts an atom to a char list."
603603
604604 # Module doesn't exist
605- iex> docs = Code.get_docs(ModuleNotGood, :all)
605+ iex> Code.get_docs(ModuleNotGood, :all)
606606 nil
607607
608608 """
Original file line number Diff line number Diff line change @@ -1174,6 +1174,8 @@ defmodule Enum do
11741174
11751175 iex> Enum.member?(1..10, 5)
11761176 true
1177+ iex> Enum.member?(1..10, 5.0)
1178+ false
11771179
11781180 iex> Enum.member?([:a, :b, :c], :d)
11791181 false
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ defimpl Enumerable, for: Range do
7777 { :done , acc }
7878 end
7979
80- def member? ( first .. last , value ) do
80+ def member? ( first .. last , value ) when is_integer ( value ) do
8181 validate_range! ( first , last )
8282 if first <= last do
8383 { :ok , first <= value and value <= last }
@@ -86,6 +86,10 @@ defimpl Enumerable, for: Range do
8686 end
8787 end
8888
89+ def member? ( _ .. _ , _value ) do
90+ { :ok , false }
91+ end
92+
8993 def count ( first .. last ) do
9094 validate_range! ( first , last )
9195 if first <= last do
You can’t perform that action at this time.
0 commit comments