diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_refinement.rb | 14 | ||||
-rw-r--r-- | version.h | 6 | ||||
-rw-r--r-- | vm_eval.c | 9 |
4 files changed, 28 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Wed Nov 16 23:40:29 2016 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org> + + * vm_eval.c (vm_call0_body): refined module should not be skipped as + prepended. [Bug #12920] + Tue Nov 15 03:14:02 2016 NARUSE, Yui <naruse@ruby-lang.org> * ext/-test/file/fs.c (get_atime_p): Updating of file access times diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb index f674783a01..dd1c9bcd89 100644 --- a/test/ruby/test_refinement.rb +++ b/test/ruby/test_refinement.rb @@ -1623,6 +1623,20 @@ class TestRefinement < Test::Unit::TestCase end end + def test_refine_with_prepend + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + bug = '[ruby-core:78073] [Bug #12920]' + Fixnum.prepend(Module.new) + Module.new do + refine Fixnum do + define_method(:+) {} + end + end + assert_kind_of(Time, Time.now, bug) + end; + end + private def eval_using(mod, s) @@ -1,10 +1,10 @@ #define RUBY_VERSION "2.3.3" -#define RUBY_RELEASE_DATE "2016-11-15" -#define RUBY_PATCHLEVEL 218 +#define RUBY_RELEASE_DATE "2016-11-16" +#define RUBY_PATCHLEVEL 219 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 11 -#define RUBY_RELEASE_DAY 15 +#define RUBY_RELEASE_DAY 16 #include "ruby/version.h" @@ -200,14 +200,17 @@ vm_call0_body(rb_thread_t* th, struct rb_calling_info *calling, const struct rb_ case VM_METHOD_TYPE_REFINED: { const rb_method_type_t type = cc->me->def->type; - VALUE super_class; + VALUE super_class = cc->me->defined_class; - if (type == VM_METHOD_TYPE_REFINED && cc->me->def->body.refined.orig_me) { + if (type == VM_METHOD_TYPE_ZSUPER) { + super_class = RCLASS_ORIGIN(super_class); + } + else if (cc->me->def->body.refined.orig_me) { cc->me = refined_method_callable_without_refinement(cc->me); goto again; } - super_class = RCLASS_SUPER(RCLASS_ORIGIN(cc->me->defined_class)); + super_class = RCLASS_SUPER(super_class); if (!super_class || !(cc->me = rb_callable_method_entry(super_class, ci->mid))) { enum method_missing_reason ex = (type == VM_METHOD_TYPE_ZSUPER) ? MISSING_SUPER : 0; |