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

Can't call a `Proc` which has a required keyword argument and a positional argument #4344

Closed
nobu opened this Issue Nov 29, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@nobu

nobu commented Nov 29, 2016

Environment

Provide at least:

  • JRuby version
    9.1.6.0
  • Operating system and platform
    OS X El Capitan

Other relevant info you may wish to add:

  • Installed or activated gems
    none
  • Application/framework version (e.g. Rails, Sinatra)
    none
  • Environment variables
    none

Expected Behavior

$ ruby -v
ruby 2.4.0dev (2016-11-27 trunk 56907) [universal.x86_64-darwin15]
$ ruby -e 'proc{|k:|p k}.call(k: 1)'
1
$ ruby -e 'proc{|a, k:|p k}.call(0, k: 1)'
1

Keyword arguments of Proc should works even if there is a positional parameter.

Actual Behavior

$ ~/ruby/jruby-9.1.6.0/bin/jruby -v
jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.25-b02 on 1.8.0_25-b17 +jit [darwin-x86_64]
$ jruby -e 'proc{|k:| p k}.call(k: 1)'
1
$ jruby -e 'proc{|a, k:| p k}.call(0, k: 1)'
ArgumentError: missing keyword: k
  block in -e at -e:-1
       <main> at -e:3

JRuby can't pass an argument to the required keyword argument of a Proc if there is a positional parameter too.

@headius headius added this to the JRuby 9.1.7.0 milestone Nov 29, 2016

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Nov 29, 2016

Member

Thanks @nobu!

Member

headius commented Nov 29, 2016

Thanks @nobu!

@enebo

This comment has been minimized.

Show comment
Hide comment
@enebo

enebo Dec 8, 2016

Member

This is closed and some specs do cover it already.

Member

enebo commented Dec 8, 2016

This is closed and some specs do cover it already.

@enebo enebo closed this Dec 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment