[ruby-core:116885] [Ruby master Bug#20229] Empty keyword splat in array not removed in ARGSPUSH case
From:
"jeremyevans0 (Jeremy Evans) via ruby-core" <ruby-core@...>
Date:
2024-02-20 18:49:03 UTC
List:
ruby-core #116885
Issue #20229 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
Committed as commit:77c1233f79a0f96a081b70da533fbbde4f3037fa
----------------------------------------
Bug #20229: Empty keyword splat in array not removed in ARGSPUSH case
https://bugs.ruby-lang.org/issues/20229#change-106921
* Author: jeremyevans0 (Jeremy Evans)
* Status: Closed
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
For the following code:
```ruby
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
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/