From 59e581ed7811fc2afdeb410481e79adfe99e5a6a Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 21 Nov 2020 15:30:03 +0900 Subject: Fix infinite loop bug from `super` when method is prepended. --- src/vm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/vm.c') diff --git a/src/vm.c b/src/vm.c index c87fa9dc6..73ab40712 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1590,7 +1590,10 @@ RETRY_TRY_BLOCK: mrb_exc_set(mrb, exc); goto L_RAISE; } - if (target_class->tt == MRB_TT_MODULE) { + if (target_class->flags & MRB_FL_CLASS_IS_PREPENDED) { + target_class = ci->target_class; + } + else if (target_class->tt == MRB_TT_MODULE) { target_class = ci->target_class; if (target_class->tt != MRB_TT_ICLASS) { mrb_value exc = mrb_exc_new_lit(mrb, E_RUNTIME_ERROR, "superclass info lost [mruby limitations]"); -- cgit v1.2.3