Project

General

Profile

Actions

Misc #11131

closed

Unexpected splatting of empty kwargs

Added by zimbatm (zimba tm) over 9 years ago. Updated about 7 years ago.

Status:
Closed
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 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #10856: Splat with empty keyword args gives unexpected resultsClosednobu (Nobuyoshi Nakada)Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

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

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Description updated (diff)
Actions #3

Updated by nobu (Nobuyoshi Nakada) about 7 years 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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0