Project

General

Profile

Actions

Bug #15957

closed

Splatting nil as **kwargs

Added by Tietew (Toru Iwase) over 5 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.0dev (2019-06-24T15:19:49Z trunk e09afd15b7) [x86_64-linux]
[ruby-core:93354]

Description

Splatting nil as *array is ignored silently.

[1, *nil]
# => [1, 2]

But splatting nil as **kwargs raises TypeError.

{foo: 1, **nil}
# => no implicit conversion of nil into Hash (TypeError)

Is this intentional?


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #15078: Hash splat of empty hash should not create a positional argument.Closedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0