Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rkh opened this issue Dec 15, 2014 · 0 comments
Closed

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

rkh opened this issue Dec 15, 2014 · 0 comments

Comments

@rkh
Copy link
Contributor

@rkh rkh commented Dec 15, 2014

$ 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}.

@rkh rkh changed the title Arity issues with define_method and keyword arguments JRuby 9000: Arity issues with define_method and keyword arguments Dec 15, 2014
@enebo enebo added this to the JRuby 9.0.0.0-pre1 milestone Dec 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants