ruby-changes:37230
From: naruse <ko1@a...>
Date: Sun, 18 Jan 2015 00:54:11 +0900 (JST)
Subject: [ruby-changes:37230] naruse:r49311 (ruby_2_2): merge revision(s) 49221: [Backport #10731]
naruse 2015-01-18 00:53:53 +0900 (Sun, 18 Jan 2015) New Revision: 49311 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49311 Log: merge revision(s) 49221: [Backport #10731] * vm_method.c (rb_alias): raise a NameError when creating alias to a refined method if the original method of the refined method is not defined. [ruby-core:67523] [Bug #10731] Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/test/ruby/test_refinement.rb branches/ruby_2_2/version.h branches/ruby_2_2/vm_method.c Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 49310) +++ ruby_2_2/ChangeLog (revision 49311) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Sun Jan 18 00:53:38 2015 Seiei Higa <hanachin@g...> + + * vm_method.c (rb_alias): raise a NameError when creating alias to + a refined method if the original method of the refined method is + not defined. [ruby-core:67523] [Bug #10731] + Sat Jan 17 22:25:50 2015 Nobuyoshi Nakada <nobu@r...> * dir.c (need_normalization): not only HFS+, CIFS (SMB) is also Index: ruby_2_2/vm_method.c =================================================================== --- ruby_2_2/vm_method.c (revision 49310) +++ ruby_2_2/vm_method.c (revision 49311) @@ -1273,7 +1273,9 @@ rb_alias(VALUE klass, ID name, ID def) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/vm_method.c#L1273 again: orig_me = search_method(klass, def, &defined_class); - if (UNDEFINED_METHOD_ENTRY_P(orig_me)) { + if (UNDEFINED_METHOD_ENTRY_P(orig_me) || + (orig_me->def->type == VM_METHOD_TYPE_REFINED && + UNDEFINED_METHOD_ENTRY_P(orig_me->def->body.orig_me))) { if ((!RB_TYPE_P(klass, T_MODULE)) || (orig_me = search_method(rb_cObject, def, 0), UNDEFINED_METHOD_ENTRY_P(orig_me))) { Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 49310) +++ ruby_2_2/version.h (revision 49311) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.0" -#define RUBY_RELEASE_DATE "2015-01-17" -#define RUBY_PATCHLEVEL 24 +#define RUBY_RELEASE_DATE "2015-01-18" +#define RUBY_PATCHLEVEL 25 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 17 +#define RUBY_RELEASE_DAY 18 #include "ruby/version.h" Index: ruby_2_2/test/ruby/test_refinement.rb =================================================================== --- ruby_2_2/test/ruby/test_refinement.rb (revision 49310) +++ ruby_2_2/test/ruby/test_refinement.rb (revision 49311) @@ -1179,6 +1179,31 @@ class TestRefinement < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_refinement.rb#L1179 end; end + def test_alias_refined_method + assert_separately([], <<-"end;") + bug10731 = '[ruby-core:67523] [Bug #10731]' + + class C + end + + module RefinementBug + refine C do + def foo + end + + def bar + end + end + end + + assert_raise(NameError, bug10731) do + class C + alias foo bar + end + end + end; + end + private def eval_using(mod, s) Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r49221 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/