[ruby-core:93354] [Ruby trunk Bug#15957] Splatting nil as **kwargs
From:
tietew@...
Date:
2019-06-25 05:07:32 UTC
List:
ruby-core #93354
Issue #15957 has been reported by Tietew (Toru Iwase).
----------------------------------------
Bug #15957: Splatting nil as **kwargs
https://bugs.ruby-lang.org/issues/15957
* Author: Tietew (Toru Iwase)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.7.0dev (2019-06-24T15:19:49Z trunk e09afd15b7) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Splatting nil as *array is ignored silently.
```ruby
[1, *nil]
# => [1, 2]
```
But splatting nil as **kwargs raises TypeError.
```ruby
{foo: 1, **nil}
# => no implicit conversion of nil into Hash (TypeError)
```
Is this intentional?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>