From 46f578d806df70c4cae43b614e56558977a4cc44 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 11 Apr 2014 06:05:28 +0000 Subject: proc.c: fix super in bound UnboundMethod * proc.c (rb_method_call_with_block, umethod_bind): call with IClass including the module for a module instance method. [ruby-core:61936] [Bug #9721] * vm_insnhelper.c (vm_search_super_method): allow bound UnboundMethod case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_super.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/ruby/test_super.rb') diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index fcf5773501..e7825560ac 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -452,4 +452,28 @@ class TestSuper < Test::Unit::TestCase m.call end end + + def test_super_in_module_unbound_method + bug9721 = '[ruby-core:61936] [Bug #9721]' + + a = Module.new do + def foo(result) + result << "A" + end + end + + b = Module.new do + def foo(result) + result << "B" + super + end + end + + m = b.instance_method(:foo).bind(Object.new.extend(a)) + result = [] + assert_nothing_raised(NoMethodError, bug9721) do + m.call(result) + end + assert_equal(%w[B A], result, bug9721) + end end -- cgit v1.2.3