aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Momchilov <alexander.momchilov@shopify.com>2022-11-03 14:59:48 -0400
committerPeter Zhu <peter@peterzhu.ca>2022-11-04 08:57:01 -0400
commit76a6c5d6d16cd0e55df15d66d53c6d7a9614f3d6 (patch)
treedf73246cc03472b002b25a03f3858842a63726f9
parentb83074dac7a3a1353ac8f897a510cecfccc2f7c6 (diff)
downloadruby-76a6c5d6d16cd0e55df15d66d53c6d7a9614f3d6.tar.gz
Remove unnecessary branch in `UnboundMethod#bind`
Co-authored-by: Michael Herold <michael.herold@shopify.com>
-rw-r--r--proc.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/proc.c b/proc.c
index 7c76f36477..1f047cd04f 100644
--- a/proc.c
+++ b/proc.c
@@ -2571,8 +2571,7 @@ convert_umethod_to_method_components(const struct METHOD *data, VALUE recv, VALU
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 (!RB_TYPE_P(methclass, T_MODULE) && !rb_obj_is_kind_of(recv, methclass)) {
if (FL_TEST(methclass, FL_SINGLETON)) {
rb_raise(rb_eTypeError,
"singleton method called for a different object");