summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_allocation.rb8
-rw-r--r--vm_args.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/test/ruby/test_allocation.rb b/test/ruby/test_allocation.rb
index e3506b6cf5..793b041529 100644
--- a/test/ruby/test_allocation.rb
+++ b/test/ruby/test_allocation.rb
@@ -265,7 +265,7 @@ class TestAllocation < Test::Unit::TestCase
check_allocations(1, 0, "keyword(*empty_array, *empty_array, **empty_hash#{block})")
check_allocations(0, 0, "keyword(*r2k_empty_array#{block})")
- check_allocations(1, 1, "keyword(*r2k_array#{block})")
+ check_allocations(1, 0, "keyword(*r2k_array#{block})")
check_allocations(0, 1, "keyword(*empty_array, a: 2, **empty_hash#{block})")
check_allocations(0, 1, "keyword(*empty_array, **hash1, **empty_hash#{block})")
@@ -359,7 +359,7 @@ class TestAllocation < Test::Unit::TestCase
check_allocations(1, 1, "required_and_keyword(*array1, *empty_array, **hash1, **empty_hash#{block})")
check_allocations(0, 0, "required_and_keyword(*r2k_empty_array1#{block})")
- check_allocations(1, 1, "required_and_keyword(*r2k_array1#{block})")
+ check_allocations(1, 0, "required_and_keyword(*r2k_array1#{block})")
check_allocations(0, 1, "required_and_keyword(1, *empty_array, a: 2, **empty_hash#{block})")
check_allocations(0, 1, "required_and_keyword(1, *empty_array, **hash1, **empty_hash#{block})")
@@ -408,9 +408,9 @@ class TestAllocation < Test::Unit::TestCase
check_allocations(1, 0, "splat_and_keyword(*array1, **nil#{block})")
check_allocations(1, 0, "splat_and_keyword(*r2k_empty_array#{block})")
- check_allocations(1, 1, "splat_and_keyword(*r2k_array#{block})")
+ check_allocations(1, 0, "splat_and_keyword(*r2k_array#{block})")
check_allocations(1, 0, "splat_and_keyword(*r2k_empty_array1#{block})")
- check_allocations(1, 1, "splat_and_keyword(*r2k_array1#{block})")
+ check_allocations(1, 0, "splat_and_keyword(*r2k_array1#{block})")
RUBY
end
diff --git a/vm_args.c b/vm_args.c
index 4449113790..abd9cf75f6 100644
--- a/vm_args.c
+++ b/vm_args.c
@@ -718,7 +718,7 @@ setup_parameters_complex(rb_execution_context_t * const ec, const rb_iseq_t * co
if (RB_TYPE_P(rest_last, T_HASH) && FL_TEST_RAW(rest_last, RHASH_PASS_AS_KEYWORDS)) {
// def f(**kw); a = [..., kw]; g(*a)
splat_flagged_keyword_hash = rest_last;
- if (!RHASH_EMPTY_P(rest_last) || (ISEQ_BODY(iseq)->param.flags.has_kwrest)) {
+ if (!(RHASH_EMPTY_P(rest_last) || ISEQ_BODY(iseq)->param.flags.has_kw) || (ISEQ_BODY(iseq)->param.flags.has_kwrest)) {
rest_last = rb_hash_dup(rest_last);
}
kw_flag |= VM_CALL_KW_SPLAT | VM_CALL_KW_SPLAT_MUT;