Project

General

Profile

Actions

Bug #20229

closed

Empty keyword splat in array not removed in ARGSPUSH case

Added by jeremyevans0 (Jeremy Evans) 10 months ago. Updated 9 months ago.

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

Description

For the following code:

a = []
kw = {}
[*a, **kw]

Ruby 2.0-3.3 return [{}], when the desired result (since 2.7) is [].

I discovered this while working on an optimization for the ARGSCAT case, where [*a, 1, **kw] allocates two arrays instead of a single array. My optimization fixes that by adding a pushtoarraykwsplat instruction as a replacement for newarraykwsplat. I've used pushtoarraykwsplat in the ARGSPUSH case to fix this bug.

My pull request for the bug fix and optimization: https://github.com/ruby/ruby/pull/9766


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20180: Inconsistent evaluation of `**{}` depending on position in arrayClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0