ruby-changes:32764
From: naruse <ko1@a...>
Date: Wed, 5 Feb 2014 22:41:09 +0900 (JST)
Subject: [ruby-changes:32764] naruse:r44843 (ruby_2_1): merge revision(s) 44527, 44552, 44553:
naruse 2014-02-05 22:41:03 +0900 (Wed, 05 Feb 2014) New Revision: 44843 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44843 Log: merge revision(s) 44527,44552,44553: * vm_insnhelper.c (vm_search_super_method): when super called in a bound UnboundMethod generated from a module, no superclass is found since the current defined class is the module, then call method_missing in that case. [ruby-core:59619] [Bug #9377] * vm_insnhelper.c (vm_search_super_method): allow bound method from a module, yet another method transplanting. Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/test/ruby/test_super.rb branches/ruby_2_1/version.h branches/ruby_2_1/vm_insnhelper.c Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 44842) +++ ruby_2_1/ChangeLog (revision 44843) @@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Wed Feb 5 22:28:41 2014 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_search_super_method): allow bound method from a + module, yet another method transplanting. + +Wed Feb 5 22:28:41 2014 Nobuyoshi Nakada <nobu@r...> + + * vm_insnhelper.c (vm_search_super_method): when super called in a + bound UnboundMethod generated from a module, no superclass is + found since the current defined class is the module, then call + method_missing in that case. [ruby-core:59619] [Bug #9377] + Wed Feb 5 21:57:40 2014 Nobuyoshi Nakada <nobu@r...> * ext/socket/socket.c (rsock_syserr_fail_host_port): add errno Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 44842) +++ ruby_2_1/version.h (revision 44843) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.1" #define RUBY_RELEASE_DATE "2014-02-05" -#define RUBY_PATCHLEVEL 20 +#define RUBY_PATCHLEVEL 21 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 2 Index: ruby_2_1/vm_insnhelper.c =================================================================== --- ruby_2_1/vm_insnhelper.c (revision 44842) +++ ruby_2_1/vm_insnhelper.c (revision 44843) @@ -2004,7 +2004,8 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_insnhelper.c#L2004 current_defined_class = RCLASS_REFINED_CLASS(current_defined_class); } - if (!FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && + if (BUILTIN_TYPE(current_defined_class) != T_MODULE && + !FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && !rb_obj_is_kind_of(ci->recv, current_defined_class)) { VALUE m = RB_TYPE_P(current_defined_class, T_ICLASS) ? RBASIC(current_defined_class)->klass : current_defined_class; @@ -2024,6 +2025,12 @@ vm_search_super_method(rb_thread_t *th, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/vm_insnhelper.c#L2025 " by define_method() is not supported." " Specify all arguments explicitly."); } + if (!ci->klass) { + /* bound instance method of module */ + ci->aux.missing_reason = NOEX_SUPER; + CI_SET_FASTPATH(ci, vm_call_method_missing, 1); + return; + } /* TODO: use inline cache */ ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class); Index: ruby_2_1/test/ruby/test_super.rb =================================================================== --- ruby_2_1/test/ruby/test_super.rb (revision 44842) +++ ruby_2_1/test/ruby/test_super.rb (revision 44843) @@ -440,4 +440,17 @@ class TestSuper < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_super.rb#L440 assert_equal(:ok, o.method(:foo).call, bug9315) end end + + def test_missing_super_in_module_unbound_method + bug9377 = '[ruby-core:59619] [Bug #9377]' + + a = Module.new do + def foo; super end + end + + m = a.instance_method(:foo).bind(Object.new) + assert_raise(NoMethodError, bug9377) do + m.call + end + end end Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r44527,44552-44553 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/