summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_refinement.rb32
-rw-r--r--version.h2
-rw-r--r--vm_insnhelper.c3
3 files changed, 35 insertions, 2 deletions
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 66202cda11..a178f24591 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -1829,6 +1829,38 @@ class TestRefinement < Test::Unit::TestCase
end;
end
+ module SuperToModule
+ class Parent
+ end
+
+ class Child < Parent
+ end
+
+ module FooBar
+ refine Parent do
+ def to_s
+ "Parent"
+ end
+ end
+
+ refine Child do
+ def to_s
+ super + " -> Child"
+ end
+ end
+ end
+
+ using FooBar
+ def Child.test
+ new.to_s
+ end
+ end
+
+ def test_super_to_module
+ bug = '[ruby-core:79588] [Bug #13227]'
+ assert_equal("Parent -> Child", SuperToModule::Child.test, bug)
+ end
+
private
def eval_using(mod, s)
diff --git a/version.h b/version.h
index 4b2b04e2b2..1a0daa7ece 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.4.0"
#define RUBY_RELEASE_DATE "2017-03-12"
-#define RUBY_PATCHLEVEL 64
+#define RUBY_PATCHLEVEL 65
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 3
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 662a2d6456..a86861c7fc 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2026,7 +2026,8 @@ vm_call_zsuper(rb_thread_t *th, rb_control_frame_t *cfp, struct rb_calling_info
if (!cc->me) {
return vm_call_method_nome(th, cfp, calling, ci, cc);
}
- if (cc->me->def->type == VM_METHOD_TYPE_REFINED) {
+ if (cc->me->def->type == VM_METHOD_TYPE_REFINED &&
+ cc->me->def->body.refined.orig_me) {
cc->me = refined_method_callable_without_refinement(cc->me);
}
return vm_call_method_each_type(th, cfp, calling, ci, cc);