aboutsummaryrefslogtreecommitdiffstats
path: root/class.c
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-12-19 04:30:25 +0900
committerKoichi Sasada <ko1@atdot.net>2020-12-19 04:33:04 +0900
commitcee02d754d76563635c1db90d2ab6c01f8492470 (patch)
tree115c68c2708aabb557243868cb870fe55b811e64 /class.c
parent04d62e6f6202684c57f2fcf71bbfcb891cd4ddd9 (diff)
downloadruby-cee02d754d76563635c1db90d2ab6c01f8492470.tar.gz
fix refinements/prepend bug
replaced method entry should be invalidated. [Bug #17386]
Diffstat (limited to 'class.c')
-rw-r--r--class.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/class.c b/class.c
index 45c9c6a87f..a76609112f 100644
--- a/class.c
+++ b/class.c
@@ -1110,7 +1110,9 @@ move_refined_method(ID key, VALUE value, void *data)
struct rb_id_table *tbl = RCLASS_M_TBL(klass);
if (me->def->type == VM_METHOD_TYPE_REFINED) {
- if (me->def->body.refined.orig_me) {
+ rb_clear_method_cache(klass, me->called_id);
+
+ if (me->def->body.refined.orig_me) {
const rb_method_entry_t *orig_me = me->def->body.refined.orig_me, *new_me;
RB_OBJ_WRITE(me, &me->def->body.refined.orig_me, NULL);
new_me = rb_method_entry_clone(me);