aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--object.c2
-rw-r--r--test/ruby/test_method.rb16
3 files changed, 24 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 83cfbaa1e1..3fb7efeca7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Aug 5 10:01:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
+
+ * object.c (rb_class_inherited_p): allow iclasses to be tested for
+ inheritance. [Bug #8686] [ruby-core:56174]
+
+ * test/ruby/test_method.rb: add test
+
Mon Aug 5 06:13:48 2013 Zachary Scott <e@zzak.io>
* enumerator.c: [DOC] Remove reference to Enumerator::Lazy#cycle
diff --git a/object.c b/object.c
index 97419b03d6..3bcad9fea7 100644
--- a/object.c
+++ b/object.c
@@ -1519,7 +1519,7 @@ rb_class_inherited_p(VALUE mod, VALUE arg)
VALUE start = mod;
if (mod == arg) return Qtrue;
- if (!CLASS_OR_MODULE_P(arg)) {
+ 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);
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index c11dcf9269..18c25f14d1 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -262,6 +262,22 @@ class TestMethod < Test::Unit::TestCase
end
end
+ def test_define_singleton_method_with_extended_method
+ bug8686 = "[ruby-core:56174]"
+
+ m = Module.new do
+ extend self
+
+ def a
+ "a"
+ end
+ end
+
+ assert_nothing_raised do
+ m.define_singleton_method(:a, m.method(:a))
+ end
+ end
+
def test_define_method_transplating
feature4254 = '[ruby-core:34267]'
m = Module.new {define_method(:meth, M.instance_method(:meth))}