Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: JRuby 1.7.4
-
Component/s: Ruby 1.9.3
-
Labels:None
-
Testcase included:yes
-
Number of attachments :
Description
On 1.9 compatibility mode, each_with_index yields invalid values
when a custom Enumerable class calls Proc#call for the given block in its `each` implementation.
Diff for the test case included. (Test passes on MRI.)
###
class CustomEnumerableWithProcCall
include Enumerable
def each &block
block.call 'hello'
end
end
CustomEnumerableWithProcCall.new.each_with_index do |e, i|
p [e, i]
end
###
["hello", 0] expected. but [["hello", nil], 0]