Project

General

Profile

Actions

Bug #16560

closed

Proc autosplats first argument if called with one argument and empty keyword splat

Added by Dan0042 (Daniel DeLorme) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:96990]

Description

While working on understanding the vm_args.c code via refactoring, I found the following:

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0