Skip to content

JRuby 9000: Arity issues with define_method and keyword arguments #2320

@rkh

Description

@rkh
$ ruby -v
jruby 9.0.0.0-SNAPSHOT (2.2.0p0) 2014-12-14 31f21b9 Java HotSpot(TM) 64-Bit Server VM 25.20-b23 on 1.8.0_20-b26 +jit [darwin-x86_64]

The following works:

def foo(**o) o       end
def bar(*a)  foo(*a) end

bar(x: 42) # => {:x=>42}

However, if foo is defined from a Proc, it raises an ArgumentError (which it doesn't on MRI):

Object.send(:define_method, :foo) { |**o| o }
def bar(*a) foo(*a) end

bar(x: 42) # ArgumentError: wrong number of arguments (1 for 0)

It's expected to also return {:x=>42}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions