diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 22:52:15 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-11 22:52:15 +0000 |
commit | 4ff235fe433124eed0ee089b8a9d85f74891952f (patch) | |
tree | 7a4099b5938f1e67db95d1117812525bc555f9f7 | |
parent | 41dab62222a24c1ca1d2bf370afbfc02cd5e0d16 (diff) |
merge revision(s) 56489: [Backport #12832]
* proc.c (mnew_internal): follow the original class, not to loop
the prepended module. [ruby-core:77591] [Bug #12832]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | test/ruby/test_method.rb | 16 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 23 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Sat Nov 12 07:48:07 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * proc.c (mnew_internal): follow the original class, not to loop + the prepended module. [ruby-core:77591] [Bug #12832] + Sat Nov 12 07:47:19 2016 Shugo Maeda <shugo@ruby-lang.org> * cont.c (cont_new): disable optimization if clang's version is @@ -1206,7 +1206,7 @@ mnew_internal(rb_method_entry_t *me, VALUE defined_class, VALUE klass, } } if (def && def->type == VM_METHOD_TYPE_ZSUPER) { - klass = RCLASS_SUPER(defined_class); + klass = RCLASS_SUPER(RCLASS_ORIGIN(defined_class)); id = def->original_id; me = rb_method_entry_without_refinements(klass, id, &defined_class); goto again; diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index 35ddc87bcc..6a21ef4f69 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -856,6 +856,22 @@ class TestMethod < Test::Unit::TestCase assert_nil(m, Feature9781) end + def test_prepended_public_zsuper + mod = EnvUtil.labeled_module("Mod") {private def foo; :ok end} + mods = [mod] + obj = Object.new.extend(mod) + class << obj + public :foo + end + 2.times do |i| + mods.unshift(mod = EnvUtil.labeled_module("Mod#{i}") {def foo; end}) + obj.singleton_class.prepend(mod) + end + m = obj.method(:foo) + assert_equal(mods, mods.map {m.owner.tap {m = m.super_method}}) + assert_nil(m) + end + def rest_parameter(*rest) rest end @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-11-12" -#define RUBY_PATCHLEVEL 389 +#define RUBY_PATCHLEVEL 390 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 11 |