1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Removed NIL/TRUE/FALSE

Deprerecated constants which had been warned since 2.4.
This commit is contained in:
Nobuyoshi Nakada 2020-04-17 17:35:17 +09:00
parent 3152977b31
commit 62554ca978
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 0 additions and 39 deletions

View file

@ -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"

View file

@ -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 Rubys 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