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

parent 96637a77
......@@ -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));
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment