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

Projects

None yet

3 participants

@nobu
nobu commented Nov 29, 2016 edited

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
Member
headius commented Nov 29, 2016

Thanks @nobu!

@JoshCheek JoshCheek referenced this issue in ruby/rake Dec 2, 2016
Merged

Actions adore keyword arguments #174

@enebo
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