Enumerable doesn't wrap objects properly
----------------------------------------

                 Key: JRUBY-5623
                 URL: http://jira.codehaus.org/browse/JRUBY-5623
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.6
         Environment: osx snow leopard
            Reporter: Xavier Shay


{code}
class A
  include Enumerable

  def initialize
    @hash = {:a => [1], :b => [2,3]}
  end

  def order
    [:a, :b]
  end

  def each
    order.each { |k| yield( k,@hash[k] ) }
    self
  end
end

A.new.each     {|x, y| puts [x, y].inspect }
A.new.map.each {|x, y| puts [x, y].inspect }

# Expected output, seen on jruby1.8 and MRI1.9.2
# [:a, [1]]
# [:b, [2, 3]]
# [:a, [1]]
# [:b, [2, 3]]

# jruby1.9 output, last two lines are wrong
# [:a, [1]]
# [:b, [2, 3]]
# [:a, nil]
# [:b, nil]
{code}

This test case could perhaps be more minimal than it is, but it clearly 
displays the issue.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.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


Reply via email to