diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-30 00:58:58 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-12-30 00:58:58 +0000 |
commit | b873dfc6a21a25d03c2435bed2973c680b1a83a9 (patch) | |
tree | 9e1346e210b1e2b33378b9de39f805cf6a44d2f3 /object.c | |
parent | a7a11f078ef1f45f51f8f48c1d091986fe14a8a8 (diff) | |
download | ruby-b873dfc6a21a25d03c2435bed2973c680b1a83a9.tar.gz |
object.c: fix prepend cmp
* object.c (rb_class_inherited_p): search the corresponding
ancestor to prepended module from prepending class itself.
[ruby-core:72493] [Bug #11878]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1549,18 +1549,15 @@ rb_mod_eqq(VALUE mod, VALUE arg) VALUE rb_class_inherited_p(VALUE mod, VALUE arg) { - VALUE start = mod; - if (mod == arg) return Qtrue; if (!CLASS_OR_MODULE_P(arg) && !RB_TYPE_P(arg, T_ICLASS)) { rb_raise(rb_eTypeError, "compared with non class/module"); } - arg = RCLASS_ORIGIN(arg); - if (class_search_ancestor(mod, arg)) { + if (class_search_ancestor(mod, RCLASS_ORIGIN(arg))) { return Qtrue; } /* not mod < arg; check if mod > arg */ - if (class_search_ancestor(arg, start)) { + if (class_search_ancestor(arg, mod)) { return Qfalse; } return Qnil; |