[前][次][番号順一覧][スレッド一覧]

ruby-changes:37000

From: naruse <ko1@a...>
Date: Wed, 31 Dec 2014 15:27:36 +0900 (JST)
Subject: [ruby-changes:37000] naruse:r49081 (ruby_2_2): merge revision(s) 49041: [Backport #10659]

naruse	2014-12-31 15:27:12 +0900 (Wed, 31 Dec 2014)

  New Revision: 49081

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49081

  Log:
    merge revision(s) 49041: [Backport #10659]
    
    * parse.y (f_kwrest, new_args_tail_gen): unnamed rest keyword and
      keywords bits arguments should be unique.  since internal IDs
      depend on the local variable index in the current scope, new ID
      should be made before popping those vtables.
      [ruby-core:67157] [Bug #10659]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/parse.y
    branches/ruby_2_2/test/ruby/test_keyword.rb
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 49080)
+++ ruby_2_2/ChangeLog	(revision 49081)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Wed Dec 31 15:26:46 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (f_kwrest, new_args_tail_gen): unnamed rest keyword and
+	  keywords bits arguments should be unique.  since internal IDs
+	  depend on the local variable index in the current scope, new ID
+	  should be made before popping those vtables.
+	  [ruby-core:67157] [Bug #10659]
+
 Wed Dec 31 14:11:58 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* ext/tk/lib/tkextlib/tcllib/plotchart.rb: fix to invoke correct function
Index: ruby_2_2/parse.y
===================================================================
--- ruby_2_2/parse.y	(revision 49080)
+++ ruby_2_2/parse.y	(revision 49081)
@@ -4829,6 +4829,7 @@ f_kwrest	: kwrest_mark tIDENTIFIER https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L4829
 		| kwrest_mark
 		    {
 			$$ = internal_id();
+			arg_var($$);
 		    }
 		;
 
@@ -9768,6 +9769,8 @@ new_args_tail_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L9769
 	    kwn = kwn->nd_next;
 	}
 
+	kw_bits = internal_id();
+	if (kr && is_junk_id(kr)) vtable_pop(lvtbl->args, 1);
 	vtable_pop(lvtbl->args, vtable_size(required_kw_vars) + vtable_size(kw_vars) + (b != 0));
 
 	for (i=0; i<vtable_size(required_kw_vars); i++) arg_var(required_kw_vars->tbl[i]);
@@ -9775,7 +9778,6 @@ new_args_tail_gen(struct parser_params * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/parse.y#L9778
 	vtable_free(required_kw_vars);
 	vtable_free(kw_vars);
 
-	kw_bits = internal_id();
 	arg_var(kw_bits);
 	if (kr) arg_var(kr);
 	if (b) arg_var(b);
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 49080)
+++ ruby_2_2/version.h	(revision 49081)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.0"
 #define RUBY_RELEASE_DATE "2014-12-31"
-#define RUBY_PATCHLEVEL 3
+#define RUBY_PATCHLEVEL 4
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 12
Index: ruby_2_2/test/ruby/test_keyword.rb
===================================================================
--- ruby_2_2/test/ruby/test_keyword.rb	(revision 49080)
+++ ruby_2_2/test/ruby/test_keyword.rb	(revision 49081)
@@ -539,4 +539,24 @@ class TestKeywordArguments < Test::Unit: https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_keyword.rb#L539
       o.foo {raise "unreachable"}
     }
   end
+
+  def test_super_with_anon_restkeywords
+    bug10659 = '[ruby-core:67157] [Bug #10659]'
+
+    foo = Class.new do
+      def foo(**h)
+        h
+      end
+    end
+
+    class << (obj = foo.new)
+      def foo(bar: "bar", **)
+        super
+      end
+    end
+
+    assert_nothing_raised(TypeError, bug10659) {
+      assert_equal({:bar => "bar"}, obj.foo, bug10659)
+    }
+  end
 end

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r49041


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]