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

Comments

Projects
None yet
2 participants
@jnicklas
Copy link

jnicklas commented Jan 25, 2015

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

This comment has been minimized.

Copy link
Author

jnicklas commented Jan 30, 2015

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
You can’t perform that action at this time.