From 44658707d24ccad75b66e2509396e30865111331 Mon Sep 17 00:00:00 2001 From: nagachika Date: Mon, 3 Jun 2013 14:57:36 +0000 Subject: [PATCH] merge revision(s) 40807: [Backport #8416] * compile.c (iseq_compile_each): forward anonymous and first keyword rest argument one. [ruby-core:55033] [Bug #8416]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ compile.c | 2 +- test/ruby/test_keyword.rb | 30 ++++++++++++++++++++++++++++++ version.h | 6 +++--- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6c4605417..f336812d65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 3 23:22:58 2013 Nobuyoshi Nakada + + * compile.c (iseq_compile_each): forward anonymous and first keyword + rest argument one. [ruby-core:55033] [Bug #8416]. + Sun Jun 2 22:39:24 2013 Zachary Scott * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143] diff --git a/compile.c b/compile.c index 34c9ae2b37..95d47f4f32 100644 --- a/compile.c +++ b/compile.c @@ -4471,7 +4471,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } } - if (liseq->arg_keyword > 0) { + if (liseq->arg_keyword >= 0) { int local_size = liseq->local_size; int idx = local_size - liseq->arg_keyword; argc++; diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 85a33d4be7..5f53483918 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -312,4 +312,34 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal([42, {:bar=>"x"}], a.new.foo(42), bug8236) assert_equal([42, {:bar=>"x"}], b.new.foo(42), bug8236) end + + def test_zsuper_only_named_kwrest + bug8416 = '[ruby-core:55033] [Bug #8416]' + base = Class.new do + def foo(**h) + h + end + end + a = Class.new(base) do + def foo(**h) + super + end + end + assert_equal({:bar=>"x"}, a.new.foo(bar: "x"), bug8416) + end + + def test_zsuper_only_anonymous_kwrest + bug8416 = '[ruby-core:55033] [Bug #8416]' + base = Class.new do + def foo(**h) + h + end + end + a = Class.new(base) do + def foo(**) + super + end + end + assert_equal({:bar=>"x"}, a.new.foo(bar: "x"), bug8416) + end end diff --git a/version.h b/version.h index 09af43864e..6a294c52f3 100644 --- a/version.h +++ b/version.h @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-06-02" -#define RUBY_PATCHLEVEL 198 +#define RUBY_RELEASE_DATE "2013-06-03" +#define RUBY_PATCHLEVEL 199 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 2 +#define RUBY_RELEASE_DAY 3 #include "ruby/version.h"