summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-07 09:08:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-08-07 09:08:29 +0000
commit41d220441da76c69c1a7d3b58687f0bbf3d8166d (patch)
treea5b98a5ef153019b21b3854f29d724d0f0b24e92
parentf5f6859b42851cd19be6a3aaed55318b45cf40d0 (diff)
deprecate TRUE,FALSE,NIL
* object.c (InitVM_Object): deprecate toplevel constants TRUE, FALSE, and NIL. [Feature #12574] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rwxr-xr-x[-rw-r--r--]basictest/test.rb4
-rw-r--r--object.c8
-rw-r--r--test/ruby/test_eval.rb4
4 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 0c2b6ee..acf74a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 7 18:08:27 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (InitVM_Object): deprecate toplevel constants TRUE,
+ FALSE, and NIL. [Feature #12574]
+
Sun Aug 7 06:48:21 2016 Eric Wong <e@80x24.org>
* ext/openssl/ossl_ssl.c (ossl_ssl_write_internal):
diff --git a/basictest/test.rb b/basictest/test.rb
index 0ba4503..8472a0d 100644..100755
--- a/basictest/test.rb
+++ b/basictest/test.rb
@@ -1860,11 +1860,9 @@ $bad=false
eval 'while false; $bad = true; print "foo\n" end'
test_ok(!$bad)
-test_ok(eval('TRUE'))
+test_ok(eval('Object'))
test_ok(eval('true'))
-test_ok(!eval('NIL'))
test_ok(!eval('nil'))
-test_ok(!eval('FALSE'))
test_ok(!eval('false'))
$foo = 'test_ok(true)'
diff --git a/object.c b/object.c
index c58a46b..d09c244 100644
--- a/object.c
+++ b/object.c
@@ -3613,6 +3613,14 @@ InitVM_Object(void)
* An alias of +false+
*/
rb_define_global_const("FALSE", Qfalse);
+
+ {
+ VALUE names[3];
+ names[0] = ID2SYM(rb_intern_const("TRUE"));
+ names[1] = ID2SYM(rb_intern_const("FALSE"));
+ names[2] = ID2SYM(rb_intern_const("NIL"));
+ rb_mod_deprecate_constant(3, names, rb_cObject);
+ }
}
void
diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb
index 9108c23..dba5477 100644
--- a/test/ruby/test_eval.rb
+++ b/test/ruby/test_eval.rb
@@ -271,11 +271,9 @@ class TestEval < Test::Unit::TestCase
eval 'while false; bad = true; print "foo\n" end'
assert(!bad)
- assert(eval('TRUE'))
+ assert(eval('Object'))
assert(eval('true'))
- assert(!eval('NIL'))
assert(!eval('nil'))
- assert(!eval('FALSE'))
assert(!eval('false'))
$foo = 'assert(true)'