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

Keyword arguments incompatibility #2518

Closed
jnicklas opened this issue Jan 25, 2015 · 1 comment · Fixed by #2540
Closed

Keyword arguments incompatibility #2518

jnicklas opened this issue Jan 25, 2015 · 1 comment · Fixed by #2540

Comments

@jnicklas
Copy link

This seems somewhat related to #2512, and may even be caused by the same problem, but it causes a a different problem, so I thought I'd report it separately.

Offending code looks like this:

def call_block(&block)
  block.call("foo", bar: "quox")
end

call_block { |foo, bar:| puts bar }

On MRI this correctly produces the string "quox", but on JRuby (master), this produces an error like this:

ArgumentError: missing keyword: bar
          call at org/jruby/RubyProc.java:289
  call_block_1 at test.rb:2
    __script__ at test.rb:5

Interestingly, omitting the first parameter to the block (foo in the example above) makes the code run without problem. The following correctly prints "quox" on JRuby master:

def call_block(&block)
  block.call(bar: "quox")
end

call_block { |bar:| puts bar }
@jnicklas
Copy link
Author

Awesome! :D

@enebo enebo added this to the 9.0.0.0.pre2 milestone Jan 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants