Remove incorrect setting of KW_SPLAT_MUT flag
Fixes [Bug #20701] Co-authored-by: Pablo Herrero <pablodherrero@gmail.com>
This commit is contained in:
parent
2459e79b80
commit
a3562c2a0a
Notes:
git
2024-08-27 16:08:42 +00:00
Merged: https://github.com/ruby/ruby/pull/11468 Merged-By: jeremyevans <code@jeremyevans.net>
@ -6249,7 +6249,6 @@ setup_args_core(rb_iseq_t *iseq, LINK_ANCHOR *const args, const NODE *argn,
|
|||||||
if (kwnode) {
|
if (kwnode) {
|
||||||
// kwsplat
|
// kwsplat
|
||||||
*flag_ptr |= VM_CALL_KW_SPLAT;
|
*flag_ptr |= VM_CALL_KW_SPLAT;
|
||||||
*flag_ptr |= VM_CALL_KW_SPLAT_MUT;
|
|
||||||
compile_hash(iseq, args, kwnode, TRUE, FALSE);
|
compile_hash(iseq, args, kwnode, TRUE, FALSE);
|
||||||
argc += 1;
|
argc += 1;
|
||||||
}
|
}
|
||||||
|
@ -345,6 +345,18 @@ class TestCall < Test::Unit::TestCase
|
|||||||
assert_equal Hash, f(*[], **o).class
|
assert_equal Hash, f(*[], **o).class
|
||||||
end
|
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
|
def test_kwsplat_block_order
|
||||||
o = Object.new
|
o = Object.new
|
||||||
ary = []
|
ary = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user