Junegunn Choi created JRUBY-6563:
------------------------------------
Summary: each_with_index yields invalid values when custom
Enumerable class calls Proc#call
Key: JRUBY-6563
URL: https://jira.codehaus.org/browse/JRUBY-6563
Project: JRuby
Issue Type: Bug
Components: Ruby 1.9.3
Reporter: Junegunn Choi
Assignee: Thomas E Enebo
Priority: Minor
Attachments: each_with_index_19_test.patch
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]
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email