Project

General

Profile

Bug #11063 ยป special_singletons.patch

rbjl (Jan Lelis), 04/12/2015 07:50 PM

View differences:

object.c
static VALUE
rb_mod_singleton_p(VALUE klass)
{
if (RB_TYPE_P(klass, T_CLASS) && FL_TEST(klass, FL_SINGLETON))
if (RB_TYPE_P(klass, T_CLASS) && (FL_TEST(klass, FL_SINGLETON) || klass == rb_cNilClass || klass == rb_cTrueClass || klass == rb_cFalseClass))
return Qtrue;
return Qfalse;
}
test/ruby/test_class.rb
feature7609 = '[ruby-core:51087] [Feature #7609]'
assert_predicate(self.singleton_class, :singleton_class?, feature7609)
assert_not_predicate(self.class, :singleton_class?, feature7609)
assert NilClass.singleton_class?
end
def test_freeze_to_s
    (1-1/1)