
Issue #20051 has been updated by jeremyevans0 (Jeremy Evans). I submitted a pull request to fix this issue: https://github.com/ruby/ruby/pull/9172 ---------------------------------------- Bug #20051: Op asgn calls handle keywords and keyword splats as positional arguments https://bugs.ruby-lang.org/issues/20051#change-105603 * Author: jeremyevans0 (Jeremy Evans) * Status: Open * Priority: Normal * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- Ruby passes a keywords given to op asgn method calls as a positional hash argument, both to `[]` and `[]=`: ```ruby foo[kw: 1] += bar ``` This seems wrong, because `foo[kw: 1]` passes `kw: 1` as keywords. Worse, Ruby passes a keyword splat given to the op asgn method calls as a regular positional argument to `[]` and `[]=`, with no `to_hash` conversion: ```ruby foo[**kw] += bar ``` Example: ```ruby [1][**0] += 2 # => 3 ``` I'll try to fix this before the 3.3 release if I have time, but if anyone else wants to work on a fix, please do so. -- https://bugs.ruby-lang.org/