Project

General

Profile

Misc #11131

Unexpected splatting of empty kwargs

Added by zimbatm (zimba tm) almost 4 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
[ruby-core:69116]

Description

def foo(); :ok end
foo(*[]) #=> :ok
foo(**{}) #=> ArgumentError: wrong number of arguments (1 for 0)
foo(*[], **{}) #=> ArgumentError: wrong number of arguments (1 for 0)

I was expecting kwargs splatting to work the same as args splatting and be ignored when an empty container is passed.


Related issues

Is duplicate of Ruby trunk - Bug #10856: Splat with empty keyword args gives unexpected resultsClosedActions

History

#1

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Is duplicate of Bug #10856: Splat with empty keyword args gives unexpected results added

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Description updated (diff)
#3

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r59519.


splat keyword hash

  • compile.c (compile_array_keyword_arg): set keyword splat flag if
    explicitly splatted. [ruby-core:68124] [Bug #10856]

  • vm_args.c (setup_parameters_complex): try keyword hash splat if
    given.

Also available in: Atom PDF