diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2025-12-02 17:34:36 -0800 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2025-12-12 08:56:50 -0800 |
| commit | 88f1d98676d435a79e2086ed8054b459f1b4bd2a (patch) | |
| tree | c7946a529bf1866ee786f68cab4219d88f9e70f1 /include/ruby/internal/encoding | |
| parent | 6dc27d14a0427da7b28a6884578009a9740f69fd (diff) | |
Fix allocationless anonymous splat keyword argument check
Previously, if an argument splat and keywords are provided by
the caller, it did not check whether the method/proc accepted
keywords before avoiding the allocation. This is incorrect,
because if the method/proc does not accept keywords, the
keywords passed by the caller are added as a positional
argument, so there must be an allocation to avoid mutating
the positional splat argument.
Add a check that if the caller passes keywords, the
method/proc must accept keywords in order to optimize.
If the caller passes a keyword splat, either the
method/proc must accept keywords, or the keyword splat must
be empty in order to optimize.
If keywords are explicitly disallowed via `**nil`, the
optimization should be skipped, because the array is mutated
before the ArgumentError exception is raised.
In addition to a test for the correct behavior, add an
allocation test for a method that accepts an anonymous splat
without keywords.
Fixes [Bug #21757]
Diffstat (limited to 'include/ruby/internal/encoding')
0 files changed, 0 insertions, 0 deletions
