Project

General

Profile

Actions

Bug #7630

closed

Proc/block doesn't take keyword arguments

Added by ktsj (Kazuki Tsujimoto) over 11 years ago. Updated over 11 years ago.

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

Description

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

$ ./ruby -e '
def m
yield
end
m{|k: 0|}
'
-e:5:in block in <main>': undefined method key?' 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


Files

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

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #7665: keyrest argument overwrites the last element of rest argumentClosednobu (Nobuyoshi Nakada)01/07/2013Actions

Updated by nobu (Nobuyoshi Nakada) over 11 years ago

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

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

Actions #2

Updated by ktsj (Kazuki Tsujimoto) over 11 years 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.
    [ruby-core:51172] [Bug #7630]

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

Actions

Also available in: Atom PDF

Like0
Like0Like0