Bug #7630

Proc/block doesn't take keyword arguments

Added by Kazuki Tsujimoto over 1 year ago. Updated over 1 year ago.

[ruby-core:51172]
Status:Closed
Priority:Normal
Assignee:Kazuki Tsujimoto
Category:core
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-12-28 trunk 38642) [x86_64-linux] Backport:

Description

=begin
$ ./ruby -e 'Proc.new{|k: 0|}.()'
-e:1:in block in <main>': undefined methodkey?' for 70368666077121:Fixnum (NoMethodError)

$ ./ruby -e '
def m
yield
end
m{|k: 0|}
'
-e:5:in block in <main>': undefined methodkey?' for nil:NilClass (NoMethodError)

$ ./ruby -e 'lambda{|k: 0|}.()'

I think Proc/block should take keyword arguments as well as lambda.
I've attached a patch.
=end

proc-keyword-arg.patch Magnifier (2.72 KB) Kazuki Tsujimoto, 12/28/2012 08:47 PM


Related issues

Related to ruby-trunk - Bug #7665: keyrest argument overwrites the last element of rest argu... Closed 01/07/2013

Associated revisions

Revision 38657
Added by Kazuki Tsujimoto over 1 year ago

  • vm_insnhelper.c: set keyword hash on Proc/block calls.
    [Bug #7630]

  • test/ruby/test_keyword.rb: add tests for above.

History

#1 Updated by Nobuyoshi Nakada over 1 year ago

  • Category set to core
  • Status changed from Open to Assigned
  • Assignee set to Kazuki Tsujimoto

It seems accessing out of the stack, so I think this bug is critical.
Please fix it with a test.

#2 Updated by Kazuki Tsujimoto over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r38657.
Kazuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • vm_insnhelper.c: set keyword hash on Proc/block calls.
    [Bug #7630]

  • test/ruby/test_keyword.rb: add tests for above.

Also available in: Atom PDF