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

ruby-changes:44045

From: nobu <ko1@a...>
Date: Fri, 9 Sep 2016 10:10:11 +0900 (JST)
Subject: [ruby-changes:44045] nobu:r56118 (trunk): variable.c: fix deprecated constant message

nobu	2016-09-09 10:10:01 +0900 (Fri, 09 Sep 2016)

  New Revision: 56118

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

  Log:
    variable.c: fix deprecated constant message
    
    * variable.c (rb_const_search): warn with the actual class/module
      name which defines the deprecated constant.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_module.rb
    trunk/variable.c
Index: variable.c
===================================================================
--- variable.c	(revision 56117)
+++ variable.c	(revision 56118)
@@ -2263,7 +2263,7 @@ rb_const_search(VALUE klass, ID id, int https://github.com/ruby/ruby/blob/trunk/variable.c#L2263
 		rb_name_err_raise("private constant %2$s::%1$s referenced",
 				  tmp, ID2SYM(id));
 	    }
-	    rb_const_warn_if_deprecated(ce, klass, id);
+	    rb_const_warn_if_deprecated(ce, tmp, id);
 	    value = ce->value;
 	    if (value == Qundef) {
 		if (am == tmp) break;
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 56117)
+++ test/ruby/test_module.rb	(revision 56118)
@@ -1420,6 +1420,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L1420
     c.const_set(:FOO, "foo")
     c.deprecate_constant(:FOO)
     assert_warn(/deprecated/) {c::FOO}
+    assert_warn(/#{c}::FOO is deprecated/) {Class.new(c)::FOO}
     bug12382 = '[ruby-core:75505] [Bug #12382]'
     assert_warn(/deprecated/, bug12382) {c.class_eval "FOO"}
   end
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56117)
+++ ChangeLog	(revision 56118)
@@ -1,4 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Fri Sep  9 10:07:40 2016  Nobuyoshi Nakada  <nobu@r...>
+Fri Sep  9 10:10:00 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* variable.c (rb_const_search): warn with the actual class/module
+	  name which defines the deprecated constant.
 
 	* variable.c (rb_const_search): raise with the actual class/module
 	  name which defines the private constant.

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

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