summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-09 20:13:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-02-09 20:13:49 +0900
commite3e96e3faa1683c8ee832cb6da6f9f96d18b0d77 (patch)
treeaca0cf7dafdd2527a04d366d0250d5ee1c1ed2a4 /proc.c
parent0f05b234fba2d961f1740c094a83f9831c15b210 (diff)
Check if bindable against the refined target [Bug #16617]
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index 47f4e668b5..83ec61d0f5 100644
--- a/proc.c
+++ b/proc.c
@@ -14,6 +14,7 @@
#include "internal.h"
#include "internal/class.h"
#include "internal/error.h"
+#include "internal/eval.h"
#include "internal/object.h"
#include "internal/proc.h"
#include "internal/symbol.h"
@@ -2366,6 +2367,10 @@ convert_umethod_to_method_components(VALUE method, VALUE recv, VALUE *methclass_
VALUE iclass = data->me->defined_class;
VALUE klass = CLASS_OF(recv);
+ if (RB_TYPE_P(methclass, T_MODULE)) {
+ VALUE refined_class = rb_refinement_module_get_refined_class(methclass);
+ if (!NIL_P(refined_class)) methclass = refined_class;
+ }
if (!RB_TYPE_P(methclass, T_MODULE) &&
methclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, methclass)) {
if (FL_TEST(methclass, FL_SINGLETON)) {