Issue #16560 has been updated by jeremyevans0 (Jeremy Evans).

Subject changed from Empty splat is ignored, resulting in lone arg splatting to Proc autosplats first argument if called with one argument and empty keyword splat

Thanks for the report. This is probably due to the removal of the empty keyword splats.  In general, passing empty keyword splat to a method should be the same as not passing any keywords (in the master branch), and that is how it currently works:

```ruby
b.call([1,2,3])     # [1, 2]
b.call([1,2,3],**h) # [1, 2]
```

However, if you have `b.call([1,2,3],**h)`, having autosplat behavior change based on the contents of `h` is definitely not going to be what the user wants.  So I agree this is a bug (regression) and it should be fixed.  I'll try to work on a fix today.

----------------------------------------
Bug #16560: Proc autosplats first argument if called with one argument and empty keyword splat
https://bugs.ruby-lang.org/issues/16560#change-84048

* Author: Dan0042 (Daniel DeLorme)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
While working on understanding the vm_args.c code via refactoring, I found the following:

```ruby
b = proc{ |a,b=0| [a,b] }
h = {k:42}
b.call([1,2,3],**h) #=> [[1, 2, 3], {:k=>42}]
h = {} 
b.call([1,2,3],**h) #=> [1, 2]           (in 2.7)
                    #=> [[1, 2, 3], {}]  (in 2.6)
```

Since the result is different from 2.6 I think this is a bug, especially since the result in 2.7 is so different based on being an empty or non-empty splat.

In my refactoring branch I'm solving this by moving the `args_check_block_arg0` check before the `ignore_keyword_hash_p` check, but that doesn't look so easy in master.



-- 
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>