Project

General

Profile

Bug #11063 ยป special_singletons.patch

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

View differences:

object.c
2571 2571
static VALUE
2572 2572
rb_mod_singleton_p(VALUE klass)
2573 2573
{
2574
    if (RB_TYPE_P(klass, T_CLASS) && FL_TEST(klass, FL_SINGLETON))
2574
    if (RB_TYPE_P(klass, T_CLASS) && (FL_TEST(klass, FL_SINGLETON) || klass == rb_cNilClass || klass == rb_cTrueClass || klass == rb_cFalseClass))
2575 2575
	return Qtrue;
2576 2576
    return Qfalse;
2577 2577
}
test/ruby/test_class.rb
376 376
    feature7609 = '[ruby-core:51087] [Feature #7609]'
377 377
    assert_predicate(self.singleton_class, :singleton_class?, feature7609)
378 378
    assert_not_predicate(self.class, :singleton_class?, feature7609)
379
    assert NilClass.singleton_class?
379 380
  end
380 381

  
381 382
  def test_freeze_to_s
382
-