NoMethodError: undefined method `first' for :"__mspec_14_eql?__":Symbol
-----------------------------------------------------------------------

                 Key: JRUBY-4015
                 URL: http://jira.codehaus.org/browse/JRUBY-4015
             Project: JRuby
          Issue Type: Bug
          Components: Ruby 1.9
            Reporter: David Calavera
            Assignee: Thomas E Enebo


This error is done over and over again in some rubyspecs running with 1.9 
compliant mode.

Mspec raises an error in lib/mspec/mocks/mock.rb line 35:
{noformat}
def self.has_key?(keys, sym)
    !!keys.find { |k|  
      k.first == sym  #this line raises an error because "k" is a symbol but it 
should be an array
    }
  end
{noformat}

I'm trying to describe the problem: 

RubyArray.detect receives a block param. This block was instantiated with a 
body and that body is an instance of CompiledBlockLight19. That body has a 
variable called argumentType that's set to BlockBody.ARRAY == 2, BUT when that 
variable is set so the parameter passed to the block is transformed to an array 
of parameters before to call the block.

So, an example:
{noformat}
keys = [[:foo, :bar], [:bar, :baz]]
keys.find { |k| # HERE k IS THE FIRST ELEMENT OF THE EACH CONTAINED ARRAY 
INSTEAD OF THE ARRAY ITSELF
                        # WE COULD GET OTHER ELEMENTS OF THE CONTAINED ARRAY 
PASSING THEM AS PARAMETERS TO THE BLOCK SO { |k1, k2...|
  k.first == sym # THIS FAILS BECAUSE IT EXPECTS AN ARRAY
}
{noformat}



-- 
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