diff options
author | Jeremy Evans <[email protected]> | 2024-08-27 09:08:22 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-27 09:08:22 -0700 |
commit | a3562c2a0abf1c2bdd1d50377b4f929580782594 (patch) | |
tree | 9502b160b30826084658b24cc60b6b9d561e02c9 | |
parent | 2459e79b8080c168e1764045072e5bc6d5694303 (diff) |
Remove incorrect setting of KW_SPLAT_MUT flag
Fixes [Bug #20701]
Co-authored-by: Pablo Herrero <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11468
Merged-By: jeremyevans <[email protected]>
-rw-r--r-- | compile.c | 1 | ||||
-rw-r--r-- | test/ruby/test_call.rb | 12 |
2 files changed, 12 insertions, 1 deletions
@@ -6249,7 +6249,6 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn, if (kwnode) { // kwsplat *flag_ptr |= VM_CALL_KW_SPLAT; - *flag_ptr |= VM_CALL_KW_SPLAT_MUT; compile_hash(iseq, args, kwnode, TRUE, FALSE); argc += 1; } diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb index 570b5bb0a9..14847bf629 100644 --- a/test/ruby/test_call.rb +++ b/test/ruby/test_call.rb @@ -345,6 +345,18 @@ class TestCall < Test::Unit::TestCase assert_equal Hash, f(*[], **o).class end + def test_call_args_splat_with_pos_arg_kw_splat_is_not_mutable + o = Object.new + def o.foo(a, **h)= h[:splat_modified] = true + + a = [] + b = {splat_modified: false} + + o.foo(*a, :x, **b) + + assert_equal({splat_modified: false}, b) + end + def test_kwsplat_block_order o = Object.new ary = [] |