From: "jeremyevans0 (Jeremy Evans) via ruby-core" Date: 2024-01-30T20:29:18+00:00 Subject: [ruby-core:116517] [Ruby master Bug#20229] Empty keyword splat in array not removed in ARGSPUSH case Issue #20229 has been updated by jeremyevans0 (Jeremy Evans). I found that this bug was actually reported earlier in #20180, which I already have submitted a pull request to fix. I think we should use the approach in this pull request to fix this issue in master, as it is more efficient. We could backport the fix in #20180 to Ruby 3.1-3.3. ---------------------------------------- Bug #20229: Empty keyword splat in array not removed in ARGSPUSH case https://bugs.ruby-lang.org/issues/20229#change-106536 * Author: jeremyevans0 (Jeremy Evans) * Status: Open * 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/