From 7b8b936f4a1cd9a629c0465c287fd0ed40519ebe Mon Sep 17 00:00:00 2001 From: Satoshi Tagomori Date: Fri, 12 Apr 2024 18:31:22 +0900 Subject: [PATCH] [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. --- object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/object.c b/object.c index 4673ba9f69..54240f0774 100644 --- a/object.c +++ b/object.c @@ -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;