ruby-changes:57607
From: Yusuke <ko1@a...>
Date: Fri, 6 Sep 2019 16:25:11 +0900 (JST)
Subject: [ruby-changes:57607] dd83f7bf98 (master): define_method should not drop the empty keyword hash
https://git.ruby-lang.org/ruby.git/commit/?id=dd83f7bf98 From dd83f7bf98764b27385735f6f39dd090dc4854f9 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Thu, 5 Sep 2019 19:07:05 +0900 Subject: define_method should not drop the empty keyword hash Similar to 38e9c1bc35d5549575fbb263afff560e97db068e diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index dc450c0..229f0b3 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -185,7 +185,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L185 f = -> { true } assert_equal(true, f[**{}]) - assert_equal(true, f[**kw]) + assert_raise(ArgumentError) { f[**kw] } assert_raise(ArgumentError) { f[**h] } assert_raise(ArgumentError) { f[a: 1] } assert_raise(ArgumentError) { f[**h2] } @@ -193,7 +193,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L193 f = ->(a) { a } assert_raise(ArgumentError) { f[**{}] } - assert_raise(ArgumentError) { f[**kw] } + assert_equal(kw, f[**kw]) assert_equal(h, f[**h]) assert_equal(h, f[a: 1]) assert_equal(h2, f[**h2]) @@ -685,7 +685,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L685 define_method(:m) { } end assert_nil(c.m(**{})) - assert_nil(c.m(**kw)) + assert_raise(ArgumentError) { c.m(**kw) } assert_raise(ArgumentError) { c.m(**h) } assert_raise(ArgumentError) { c.m(a: 1) } assert_raise(ArgumentError) { c.m(**h2) } @@ -697,7 +697,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L697 define_method(:m) {|arg| arg } end assert_raise(ArgumentError) { c.m(**{}) } - assert_raise(ArgumentError) { c.m(**kw) } + assert_equal(kw, c.m(**kw)) assert_equal(h, c.m(**h)) assert_equal(h, c.m(a: 1)) assert_equal(h2, c.m(**h2)) diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 227ec2e..92a9bc6 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2927,7 +2927,7 @@ vm_callee_setup_block_arg(rb_execution_context_t *ec, struct rb_calling_info *ca https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2927 rb_control_frame_t *cfp = ec->cfp; VALUE arg0; - CALLER_SETUP_ARG(cfp, calling, ci, 1); /* splat arg */ + CALLER_SETUP_ARG(cfp, calling, ci, 0); /* splat arg */ if (arg_setup_type == arg_setup_block && calling->argc == 1 && -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/