From 62554ca97812b454e78a0a9daf6e962ff7a2f589 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 17 Apr 2020 17:35:17 +0900 Subject: Removed NIL/TRUE/FALSE Deprerecated constants which had been warned since 2.4. --- object.c | 15 --------------- spec/ruby/language/predefined_spec.rb | 24 ------------------------ 2 files changed, 39 deletions(-) diff --git a/object.c b/object.c index dfe3d14e6e..55d28a1500 100644 --- a/object.c +++ b/object.c @@ -4692,11 +4692,6 @@ InitVM_Object(void) rb_define_method(rb_cNilClass, "nil?", rb_true, 0); rb_undef_alloc_func(rb_cNilClass); rb_undef_method(CLASS_OF(rb_cNilClass), "new"); - /* - * An obsolete alias of +nil+ - */ - rb_define_global_const("NIL", Qnil); - rb_deprecate_constant(rb_cObject, "NIL"); rb_define_method(rb_cModule, "freeze", rb_mod_freeze, 0); rb_define_method(rb_cModule, "===", rb_mod_eqq, 1); @@ -4781,11 +4776,6 @@ InitVM_Object(void) rb_define_method(rb_cTrueClass, "===", rb_equal, 1); rb_undef_alloc_func(rb_cTrueClass); rb_undef_method(CLASS_OF(rb_cTrueClass), "new"); - /* - * An obsolete alias of +true+ - */ - rb_define_global_const("TRUE", Qtrue); - rb_deprecate_constant(rb_cObject, "TRUE"); rb_cFalseClass = rb_define_class("FalseClass", rb_cObject); rb_cFalseClass_to_s = rb_fstring_enc_lit("false", rb_usascii_encoding()); @@ -4798,11 +4788,6 @@ InitVM_Object(void) rb_define_method(rb_cFalseClass, "===", rb_equal, 1); rb_undef_alloc_func(rb_cFalseClass); rb_undef_method(CLASS_OF(rb_cFalseClass), "new"); - /* - * An obsolete alias of +false+ - */ - rb_define_global_const("FALSE", Qfalse); - rb_deprecate_constant(rb_cObject, "FALSE"); } #include "kernel.rbinc" diff --git a/spec/ruby/language/predefined_spec.rb b/spec/ruby/language/predefined_spec.rb index 970071eccd..b0616da19b 100644 --- a/spec/ruby/language/predefined_spec.rb +++ b/spec/ruby/language/predefined_spec.rb @@ -1091,8 +1091,6 @@ The following constants are defined by the Ruby interpreter. DATA IO If the main program file contains the directive __END__, then the constant DATA will be initialized so that reading from it will return lines following __END__ from the source file. -FALSE FalseClass Synonym for false. -NIL NilClass Synonym for nil. RUBY_PLATFORM String The identifier of the platform running this program. This string is in the same form as the platform identifier used by the GNU configure utility (which is not a coincidence). @@ -1110,31 +1108,9 @@ SCRIPT_LINES__ Hash If a constant SCRIPT_LINES__ is defined and ref the value. TOPLEVEL_BINDING Binding A Binding object representing the binding at Ruby’s top level— the level where programs are initially executed. -TRUE TrueClass Synonym for true. =end describe "The predefined global constants" do - it "includes TRUE" do - Object.const_defined?(:TRUE).should == true - -> { - TRUE.should equal(true) - }.should complain(/constant ::TRUE is deprecated/) - end - - it "includes FALSE" do - Object.const_defined?(:FALSE).should == true - -> { - FALSE.should equal(false) - }.should complain(/constant ::FALSE is deprecated/) - end - - it "includes NIL" do - Object.const_defined?(:NIL).should == true - -> { - NIL.should equal(nil) - }.should complain(/constant ::NIL is deprecated/) - end - it "includes STDIN" do Object.const_defined?(:STDIN).should == true end -- cgit v1.2.3