Skip to content

**operator behavior is different from MRI #4210

@pbl-pw

Description

@pbl-pw
class AA < BasicObject
    def to_hash
        {}
    end
end

obj = AA.new

def func(**hash)
    puts hash
end

func **obj          # <- error on this line

run ok in MRI,but jruby report error :

NoMethodError: undefined method `respond_to?' for #<AA:0x282003e1>
  <main> at test.rb:13
    load at org/jruby/RubyKernel.java:974
  <main> at -e:1

i found jruby call respond_to? :to_hash before call to_hash,but MRI not.

ENV

jruby 9.1.5.0 (2.3.1) 2016-09-23 fffffff Java HotSpot(TM) Client VM 25.101-b13 on 1.8.0_101-b13 +jit [mswin32-x86]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions