Project

General

Profile

Actions

Bug #12048

closed

"Unknown keyword" error when calling function with keyword argument inside parameter

Added by devwout (Ewout VT) about 8 years ago. Updated about 8 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
[ruby-core:73687]

Description

Contents of attached file ruby_bug.rb

def x(a) ; a ; end
def y(*a, b: nil) ; end
y(x(c: 1))
$ ruby ruby_bug.rb
ruby_bug.rb:2:in `y': unknown keyword: c (ArgumentError)
        from ruby_bug.rb:3:in `<main>'

Not only ruby 2.3 is affected, same hehavior on ruby 2.2.3, 2.2.4 and 2.1.

Updated by nobu (Nobuyoshi Nakada) about 8 years ago

  • Description updated (diff)
  • Status changed from Open to Rejected

It's same as

def y(b: nil) end
x = {c: 1}
y(x)

Keyword arguments are passed as a Hash, x here.

Actions

Also available in: Atom PDF

Like0
Like0