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

ruby-changes:33147

From: naruse <ko1@a...>
Date: Sat, 1 Mar 2014 17:25:36 +0900 (JST)
Subject: [ruby-changes:33147] naruse:r45226 (ruby_2_1): merge revision(s) 44433: [Backport #9299]

naruse	2014-03-01 17:25:29 +0900 (Sat, 01 Mar 2014)

  New Revision: 45226

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

  Log:
    merge revision(s) 44433: [Backport #9299]
    
    * proc.c: Having any mandatory keyword argument increases min arity
      [#9299]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/proc.c
    branches/ruby_2_1/test/ruby/test_proc.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 45225)
+++ ruby_2_1/ChangeLog	(revision 45226)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Sat Mar  1 17:25:12 2014  Marc-Andre Lafortune  <ruby-core@m...>
+
+	* proc.c: Having any mandatory keyword argument increases min arity
+	  [#9299]
+
 Mon Feb 24 14:56:41 2014  WATANABE Hirofumi  <eban@r...>
 
 	* tool/make-snapshot: needs CXXFLAGS.  [ruby-core:59393][Bug #9320]
Index: ruby_2_1/proc.c
===================================================================
--- ruby_2_1/proc.c	(revision 45225)
+++ ruby_2_1/proc.c	(revision 45226)
@@ -828,7 +828,7 @@ rb_iseq_min_max_arity(const rb_iseq_t *i https://github.com/ruby/ruby/blob/trunk/ruby_2_1/proc.c#L828
     *max = (iseq->arg_rest == -1 && iseq->arg_keyword == -1) ?
         iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
       : UNLIMITED_ARGUMENTS;
-    return iseq->argc + iseq->arg_post_len;
+    return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
 }
 
 static int
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 45225)
+++ ruby_2_1/version.h	(revision 45226)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
-#define RUBY_RELEASE_DATE "2014-02-24"
-#define RUBY_PATCHLEVEL 77
+#define RUBY_RELEASE_DATE "2014-03-01"
+#define RUBY_PATCHLEVEL 78
 
 #define RUBY_RELEASE_YEAR 2014
-#define RUBY_RELEASE_MONTH 2
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_MONTH 3
+#define RUBY_RELEASE_DAY 1
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/ruby/test_proc.rb
===================================================================
--- ruby_2_1/test/ruby/test_proc.rb	(revision 45225)
+++ ruby_2_1/test/ruby/test_proc.rb	(revision 45226)
@@ -85,6 +85,11 @@ class TestProc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_proc.rb#L85
     assert_equal(-3, proc{|x, y=0, z, **o|}.arity)
     assert_equal(-3, proc{|x, y=0, *z, w, **o|}.arity)
 
+    assert_equal(2, proc{|x, y=0, z, a:1|}.arity)
+    assert_equal(3, proc{|x, y=0, z, a:|}.arity)
+    assert_equal(-4, proc{|x, y, *rest, a:, b:, c:|}.arity)
+    assert_equal(3, proc{|x, y=0, z, a:, **o|}.arity)
+
     assert_equal(0, lambda{}.arity)
     assert_equal(0, lambda{||}.arity)
     assert_equal(1, lambda{|x|}.arity)

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r44433


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

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