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

Passing nil as the value of a keyword argument causes JRuby to act as if there were no such keyword argument #1047

97jaz opened this issue Sep 30, 2013 · 2 comments


Copy link

@97jaz 97jaz commented Sep 30, 2013

The following simple program demonstrates the problem:

def test(foo: 10)

test(foo: nil)


2.0.0p247 :006 > test(foo: nil)
 => nil


jruby-1.7.4 :005 >   test(foo: nil)
ArgumentError: unknown keyword: foo
    from (irb):5:in `evaluate'
    from org/jruby/ `eval'
    from org/jruby/ `loop'
    from org/jruby/ `catch'
    from org/jruby/ `catch'
    from /Users/jaz/.rvm/rubies/jruby-1.7.4/bin/irb:13:in `(root)'
Copy link
Contributor Author

@97jaz 97jaz commented Sep 30, 2013

The cause appears to be the conditional at:

This code needs to distinguish between the absence of a keyword value and an explicitly provided nil. I should be able to provide a patch, I think.

Copy link

@headius headius commented Oct 1, 2013

Fixed by #1054.

@headius headius closed this Oct 1, 2013
headius added a commit that referenced this issue Oct 1, 2013
Formerly, the code attempted to extract the argument value from the
hash of provided values and test it against nil. This fails in the
case of an explicitly passed nil. The new version instead tests
whether the hash contains the desired key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants