Project

General

Profile

Actions

Bug #20051

closed

Op asgn calls handle keywords and keyword splats as positional arguments

Added by jeremyevans0 (Jeremy Evans) 11 months ago. Updated 11 months ago.

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

Description

Ruby passes a keywords given to op asgn method calls as a positional hash argument, both to [] and []=:

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:

foo[**kw] += bar

Example:

[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.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20008: f(**kw, &block) calls block.to_proc before kw.to_hash ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0