ruby-changes:26587
From: shugo <ko1@a...>
Date: Fri, 28 Dec 2012 11:23:43 +0900 (JST)
Subject: [ruby-changes:26587] shugo:r38638 (trunk): * proc.c (method_eq): fix the documentation to refer to owner.
shugo 2012-12-28 11:23:11 +0900 (Fri, 28 Dec 2012) New Revision: 38638 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38638 Log: * proc.c (method_eq): fix the documentation to refer to owner. [ruby-core:51105] [Bug #7613] * test/ruby/test_method.rb (test_alias_onwer): new test to confirm that `a == b' returns false if owners of a and b are different. Modified files: trunk/ChangeLog trunk/proc.c trunk/test/ruby/test_method.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 38637) +++ ChangeLog (revision 38638) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Dec 28 11:17:47 2012 Shugo Maeda <shugo@r...> + + * proc.c (method_eq): fix the documentation to refer to owner. + [ruby-core:51105] [Bug #7613] + + * test/ruby/test_method.rb (test_alias_onwer): new test to confirm + that `a == b' returns false if owners of a and b are different. + Fri Dec 28 07:07:43 2012 NARUSE, Yui <naruse@r...> * def/id.def: use split(/^/) instead of String#lines to support Index: proc.c =================================================================== --- proc.c (revision 38637) +++ proc.c (revision 38638) @@ -1023,7 +1023,8 @@ mnew(VALUE klass, VALUE obj, ID id, VALU https://github.com/ruby/ruby/blob/trunk/proc.c#L1023 * meth == other_meth -> true or false * * Two method objects are equal if they are bound to the same - * object and refer to the same method definition. + * object and refer to the same method definition and their owners are the + * same class or module. */ static VALUE Index: test/ruby/test_method.rb =================================================================== --- test/ruby/test_method.rb (revision 38637) +++ test/ruby/test_method.rb (revision 38638) @@ -507,4 +507,19 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L507 assert_instance_of String, __dir__ assert_equal(File.dirname(__FILE__), __dir__) end + + def test_alias_owner + bug7613 = '[ruby-core:51105]' + c = Class.new { + def foo + end + } + x = c.new + class << x + alias bar foo + end + assert_equal(c, x.method(:foo).owner) + assert_equal(x.singleton_class, x.method(:bar).owner) + assert(x.method(:foo) != x.method(:bar), bug7613) + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/