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

ruby-changes:42329

From: naruse <ko1@a...>
Date: Tue, 29 Mar 2016 22:53:53 +0900 (JST)
Subject: [ruby-changes:42329] naruse:r54403 (ruby_2_3): merge revision(s) 53635: [Backport #12003]

naruse	2016-03-29 22:53:46 +0900 (Tue, 29 Mar 2016)

  New Revision: 54403

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

  Log:
    merge revision(s) 53635: [Backport #12003]
    
    * range.c (range_eqq): revert r11113 because rb_call_super() is
      called in range_include() and thus r11113 doesn't work when the
      receiver Range object consists of non linear objects such as Date
      objects.
      [ruby-core:72908] [Bug #12003]

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/range.c
    branches/ruby_2_3/test/ruby/test_range.rb
    branches/ruby_2_3/version.h
Index: ruby_2_3/range.c
===================================================================
--- ruby_2_3/range.c	(revision 54402)
+++ ruby_2_3/range.c	(revision 54403)
@@ -23,7 +23,6 @@ static ID id_beg, id_end, id_excl, id_in https://github.com/ruby/ruby/blob/trunk/ruby_2_3/range.c#L23
 #define id_succ idSucc
 
 static VALUE r_cover_p(VALUE, VALUE, VALUE, VALUE);
-static VALUE range_include(VALUE range, VALUE val);
 
 #define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
 #define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
@@ -1135,12 +1134,7 @@ range_inspect(VALUE range) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/range.c#L1134
 static VALUE
 range_eqq(VALUE range, VALUE val)
 {
-    ID pred;
-    CONST_ID(pred, "include?");
-    if (rb_method_basic_definition_p(RBASIC_CLASS(range), pred)) {
-	return range_include(range, val);
-    }
-    return rb_funcall(range, pred, 1, val);
+    return rb_funcall(range, rb_intern("include?"), 1, val);
 }
 
 
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 54402)
+++ ruby_2_3/version.h	(revision 54403)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.0"
 #define RUBY_RELEASE_DATE "2016-03-29"
-#define RUBY_PATCHLEVEL 51
+#define RUBY_PATCHLEVEL 52
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 3
Index: ruby_2_3/test/ruby/test_range.rb
===================================================================
--- ruby_2_3/test/ruby/test_range.rb	(revision 54402)
+++ ruby_2_3/test/ruby/test_range.rb	(revision 54403)
@@ -314,6 +314,30 @@ class TestRange < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_range.rb#L314
     }
   end
 
+  def test_eqq_non_linear
+    bug12003 = '[ruby-core:72908] [Bug #12003]'
+    c = Class.new {
+      attr_reader :value
+
+      def initialize(value)
+        @value = value
+      end
+
+      def succ
+        self.class.new(@value.succ)
+      end
+
+      def ==(other)
+        @value == other.value
+      end
+
+      def <=>(other)
+        @value <=> other.value
+      end
+    }
+    assert_operator(c.new(0)..c.new(10), :===, c.new(5), bug12003)
+  end
+
   def test_include
     assert_include("a".."z", "c")
     assert_not_include("a".."z", "5")
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 54402)
+++ ruby_2_3/ChangeLog	(revision 54403)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Tue Mar 29 22:31:48 2016  Shugo Maeda  <shugo@r...>
+
+	* range.c (range_eqq): revert r11113 because rb_call_super() is
+	  called in range_include() and thus r11113 doesn't work when the
+	  receiver Range object consists of non linear objects such as Date
+	  objects.
+	  [ruby-core:72908] [Bug #12003]
+
 Tue Mar 29 22:26:55 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* vm_eval.c (rb_check_funcall_with_hook): also should call the

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r53635


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

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