summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-30 00:58:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-30 00:58:58 +0000
commita974041b0ef744c102b2b15ff30b91b4b0ea8a1c ()
tree9e1346e210b1e2b33378b9de39f805cf6a44d2f3
parentd252e224f6b2e2740985304018fe8a31b080e009 (diff)
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
-rw-r--r--ChangeLog6
-rw-r--r--object.c7
-rw-r--r--test/ruby/test_module.rb6
3 files changed, 14 insertions, 5 deletions
@@ -1,3 +1,9 @@
Wed Dec 30 09:20:00 2015 Yuki Kurihara <[email protected]>
* test/stringio/test_io.rb (test_flag): add assertion for error when
@@ -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)) {
return Qtrue;
}
/* not mod < arg; check if mod > arg */
- if (class_search_ancestor(arg, start)) {
return Qfalse;
}
return Qnil;
@@ -1566,6 +1566,12 @@ class TestModule < Test::Unit::TestCase
end
end
def test_prepend_inheritance
bug6654 = '[ruby-core:45914]'
a = labeled_module("a")