summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-09 15:17:56 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-11-09 16:39:38 +0900
commita4dff09be79b52288a47658964d25e5aa84fc960 (patch)
treec5cb08d91a84411a8a818a05ca302cf108c9e47c /vm_method.c
parenta88d7718f427acdd040f7b978e0514f0fea0b1d8 (diff)
[Bug #21673] Fix resolving refined module-defined method
A method defined in a module has no `defined_class`, use the ICLASS for it as the `defined_class`.
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 506a2919b7..bf04140cb7 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -2005,7 +2005,12 @@ resolve_refined_method(VALUE refinements, const rb_method_entry_t *me, VALUE *de
tmp_me = me->def->body.refined.orig_me;
if (tmp_me) {
- if (defined_class_ptr) *defined_class_ptr = tmp_me->defined_class;
+ if (!tmp_me->defined_class) {
+ VM_ASSERT_TYPE(tmp_me->owner, T_MODULE);
+ }
+ else if (defined_class_ptr) {
+ *defined_class_ptr = tmp_me->defined_class;
+ }
return tmp_me;
}