[DOC] Fix the wrong comment

This function checks the CL's superclasses containing the class C at
the end of it. That means C is a superclass of CL, not a subclass.
This commit is contained in:
Satoshi Tagomori 2024-04-12 18:31:22 +09:00 committed by GitHub
parent 91c457e091
commit 7b8b936f4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -869,7 +869,7 @@ rb_obj_is_instance_of(VALUE obj, VALUE c)
return RBOOL(rb_obj_class(obj) == c);
}
// Returns whether c is a proper (c != cl) subclass of cl
// Returns whether c is a proper (c != cl) superclass of cl
// Both c and cl must be T_CLASS
static VALUE
class_search_class_ancestor(VALUE cl, VALUE c)
@ -882,7 +882,7 @@ class_search_class_ancestor(VALUE cl, VALUE c)
VALUE *classes = RCLASS_SUPERCLASSES(cl);
// If c's inheritance chain is longer, it cannot be an ancestor
// We are checking for a proper subclass so don't check if they are equal
// We are checking for a proper superclass so don't check if they are equal
if (cl_depth <= c_depth)
return Qfalse;