<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_method.rb, branch v3_2_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 56ecc243e230e8e99761ec0ffc5116601f094bb0: [Backport #20868]</title>
<updated>2024-11-10T04:04:43+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2024-11-10T04:04:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ee3428aa0e3a11ed1574b7d99222f6f08737f818'/>
<id>ee3428aa0e3a11ed1574b7d99222f6f08737f818</id>
<content type='text'>
	[Bug #20868] Fix Method#hash to not change after compaction

	The hash value of a Method must remain constant after a compaction, otherwise
	it may not work as the key in a hash table.

	For example:

	    def a; end

	    # Need this method here because otherwise the iseq may be on the C stack
	    # which would get pinned and not move during compaction
	    def get_hash
	      method(:a).hash
	    end

	    puts get_hash # =&gt; 2993401401091578131

	    GC.verify_compaction_references(expand_heap: true, toward: :empty)

	    puts get_hash # =&gt; -2162775864511574135
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20868] Fix Method#hash to not change after compaction

	The hash value of a Method must remain constant after a compaction, otherwise
	it may not work as the key in a hash table.

	For example:

	    def a; end

	    # Need this method here because otherwise the iseq may be on the C stack
	    # which would get pinned and not move during compaction
	    def get_hash
	      method(:a).hash
	    end

	    puts get_hash # =&gt; 2993401401091578131

	    GC.verify_compaction_references(expand_heap: true, toward: :empty)

	    puts get_hash # =&gt; -2162775864511574135
</pre>
</div>
</content>
</entry>
<entry>
<title>UnboundMethod only refer defined_class</title>
<updated>2022-12-02T23:53:12+00:00</updated>
<author>
<name>Koichi Sasada</name>
<email>ko1@atdot.net</email>
</author>
<published>2022-12-02T20:55:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=59e389af2893c0fcf8b2cfa008c9a16825bf56ff'/>
<id>59e389af2893c0fcf8b2cfa008c9a16825bf56ff</id>
<content type='text'>
UnboundMethod records caller's class, like `D` or `E` on the
following case:

```ruby
class C
  def foo = :foo
end

class D &lt; C
end

class E &lt; C
end

d = D.instance_method(:foo)
e = E.instance_method(:foo)
```

But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't
record `D` or `E`. This behavior changes the following methods:

* `UnboundMethod#inspect` (doesn't show caller's class)
* `UnboundMethod#==` (`d == e` for example)

fix https://bugs.ruby-lang.org/issues/18798
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
UnboundMethod records caller's class, like `D` or `E` on the
following case:

```ruby
class C
  def foo = :foo
end

class D &lt; C
end

class E &lt; C
end

d = D.instance_method(:foo)
e = E.instance_method(:foo)
```

But `d` and `e` only refers `C#foo` so that UnboundMethod doesn't
record `D` or `E`. This behavior changes the following methods:

* `UnboundMethod#inspect` (doesn't show caller's class)
* `UnboundMethod#==` (`d == e` for example)

fix https://bugs.ruby-lang.org/issues/18798
</pre>
</div>
</content>
</entry>
<entry>
<title>Suppress a "warning: method redefined" in test/ruby/test_method.rb</title>
<updated>2022-10-12T12:51:23+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-10-12T12:51:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=504e388525ca7a1eeac64d08731f036b2ffc7b07'/>
<id>504e388525ca7a1eeac64d08731f036b2ffc7b07</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Reduce diff to proc.c @ b0b9f7201acab05c2a3ad92c3043a1f01df3e17f</title>
<updated>2022-09-29T13:48:35+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-09-29T10:09:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=aa490f9442c32cd0e1e449ac817f410bd5924c8b'/>
<id>aa490f9442c32cd0e1e449ac817f410bd5924c8b</id>
<content type='text'>
* So it's easy to review https://github.com/ruby/ruby/pull/6242 +
  https://github.com/ruby/ruby/pull/6467 and there are less changes
  overall.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* So it's easy to review https://github.com/ruby/ruby/pull/6242 +
  https://github.com/ruby/ruby/pull/6467 and there are less changes
  overall.
</pre>
</div>
</content>
</entry>
<entry>
<title>Extend tests for a zsuper method of which the method it resolved to has been removed</title>
<updated>2022-09-29T13:48:35+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-09-29T11:56:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c6319026caa6c8f0f569f80011e8502349a04b14'/>
<id>c6319026caa6c8f0f569f80011e8502349a04b14</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Resolve zsuper method during lookup but preserve owner separately</title>
<updated>2022-09-29T13:48:35+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-09-28T17:49:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6b7d32a5e54088b6b4014529bbf2b4b8c1a96029'/>
<id>6b7d32a5e54088b6b4014529bbf2b4b8c1a96029</id>
<content type='text'>
* See https://bugs.ruby-lang.org/issues/18729#note-34
* See [Bug #18729]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* See https://bugs.ruby-lang.org/issues/18729#note-34
* See [Bug #18729]
</pre>
</div>
</content>
</entry>
<entry>
<title>Consider resolved-through-zsuper methods equal for compatibility</title>
<updated>2022-08-20T11:44:00+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2022-08-15T14:01:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=209631a45f9682dedf718f4b4a140efe7d21a6fc'/>
<id>209631a45f9682dedf718f4b4a140efe7d21a6fc</id>
<content type='text'>
* Fixes https://bugs.ruby-lang.org/issues/18751
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Fixes https://bugs.ruby-lang.org/issues/18751
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Object#method and Module#instance_method not skip ZSUPER methods</title>
<updated>2022-08-20T11:44:00+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2021-12-27T17:39:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8212aab81a77a2a91fb7c1681b4968171193b48f'/>
<id>8212aab81a77a2a91fb7c1681b4968171193b48f</id>
<content type='text'>
Based on https://github.com/jeremyevans/ruby/commit/c95e7e5329140f640b6497905485761f3336d967

Among other things, this fixes calling visibility methods (public?,
protected?, and private?) on them.  It also fixes #owner to show the
class the zsuper method entry is defined in, instead of the original
class it references.

For some backwards compatibility, adjust #parameters and #source_location,
to show the parameters and source location of the method originally
defined. Also have the parameters and source location still be shown
by #inspect.

Clarify documentation of {Method,UnboundMethod}#owner.

Add tests based on the description of https://bugs.ruby-lang.org/issues/18435
and based on https://github.com/ruby/ruby/pull/5356#issuecomment-1005298809

Fixes [Bug #18435] [Bug #18729]

Co-authored-by: Benoit Daloze &lt;eregontp@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Based on https://github.com/jeremyevans/ruby/commit/c95e7e5329140f640b6497905485761f3336d967

Among other things, this fixes calling visibility methods (public?,
protected?, and private?) on them.  It also fixes #owner to show the
class the zsuper method entry is defined in, instead of the original
class it references.

For some backwards compatibility, adjust #parameters and #source_location,
to show the parameters and source location of the method originally
defined. Also have the parameters and source location still be shown
by #inspect.

Clarify documentation of {Method,UnboundMethod}#owner.

Add tests based on the description of https://bugs.ruby-lang.org/issues/18435
and based on https://github.com/ruby/ruby/pull/5356#issuecomment-1005298809

Fixes [Bug #18435] [Bug #18729]

Co-authored-by: Benoit Daloze &lt;eregontp@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Add {Method,UnboundMethod}#{public?,private?,protected?}"</title>
<updated>2022-08-10T20:02:52+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-06-04T01:15:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ff42e2359bdbf37e1721a82b4cfd95b31f494f3f'/>
<id>ff42e2359bdbf37e1721a82b4cfd95b31f494f3f</id>
<content type='text'>
This reverts commit 27278150685e738f84105d09843d3ba371146c7a and
58dc8bf8f15df9a33d191074e8a5d4946a3d59d5.

Visibility is an attribute of the method entry in a class, not an
attribute of the Method object.

Fixes [#18729]
Fixes [#18751]
Fixes [#18435]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 27278150685e738f84105d09843d3ba371146c7a and
58dc8bf8f15df9a33d191074e8a5d4946a3d59d5.

Visibility is an attribute of the method entry in a class, not an
attribute of the Method object.

Fixes [#18729]
Fixes [#18751]
Fixes [#18435]
</pre>
</div>
</content>
</entry>
<entry>
<title>Make define_singleton_method always define a public method</title>
<updated>2022-03-29T19:10:13+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-03-09T22:57:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=173a6b6a802d80b8cf200308fd3653832b700b1c'/>
<id>173a6b6a802d80b8cf200308fd3653832b700b1c</id>
<content type='text'>
In very unlikely cases, it could previously define a non-public method
starting in Ruby 2.1.

Fixes [Bug #18561]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In very unlikely cases, it could previously define a non-public method
starting in Ruby 2.1.

Fixes [Bug #18561]
</pre>
</div>
</content>
</entry>
</feed>
