Remove unnecessary branch in `UnboundMethod#bind`

Co-authored-by: Michael Herold <michael.herold@shopify.com>
This commit is contained in:
Alexander Momchilov 2022-11-03 14:59:48 -04:00 коммит произвёл Peter Zhu
Родитель b83074dac7
Коммит 76a6c5d6d1
1 изменённых файлов: 1 добавлений и 2 удалений

3
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");