the receiver should be included in ancestors even when it's a singleton class

This commit is contained in:
Yukihiro "Matz" Matsumoto
2013-04-30 00:51:31 +09:00
parent 96637a7723
commit a092e41020
2 changed files with 3 additions and 2 deletions
+2
View File
@@ -796,6 +796,8 @@ mrb_mod_ancestors(mrb_state *mrb, mrb_value self)
struct RClass *c = mrb_class_ptr(self);
result = mrb_ary_new(mrb);
mrb_ary_push(mrb, result, mrb_obj_value(c));
c = c->super;
while (c) {
if (c->tt == MRB_TT_ICLASS) {
mrb_ary_push(mrb, result, mrb_obj_value(c->c));
+1 -2
View File
@@ -18,8 +18,7 @@ assert('Module#ancestors', '15.2.2.4.9') do
end
sc = Test4ModuleAncestors.singleton_class
r = String.ancestors
r.class == Array and r.include?(String) and r.include?(Object) and
! sc.ancestors.include?(sc)
r.class == Array and r.include?(String) and r.include?(Object)
end
assert('Module#append_features', '15.2.2.4.10') do