Allow foo(**nil, &block_arg)

Previously, `**nil` by itself worked, but if you add a block argument,
it raised a conversion error. The presence of the block argument
shouldn't change how keyword splat works.

See: <https://bugs.ruby-lang.org/issues/20064>
This commit is contained in:
Alan Wu 2024-02-08 19:10:51 -05:00
parent e08c128417
commit e878bbd641
3 changed files with 19 additions and 4 deletions

View file

@ -563,7 +563,12 @@ splatkw
(VALUE obj, VALUE block)
// attr bool leaf = false; /* has rb_to_hash_type() */
{
obj = rb_to_hash_type(hash);
if (NIL_P(hash)) {
obj = Qnil;
}
else {
obj = rb_to_hash_type(hash);
}
}
/* put new Hash from n elements. n must be an even number. */