ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:108378] [Ruby master Bug#18751] Regression on master for Method#== when comparing public with private method
@ 2022-04-23 11:39 Eregon (Benoit Daloze)
  2022-04-25 16:22 ` [ruby-core:108395] " jeremyevans0 (Jeremy Evans)
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Eregon (Benoit Daloze) @ 2022-04-23 11:39 UTC (permalink / raw)
  To: ruby-core

Issue #18751 has been reported by Eregon (Benoit Daloze).

----------------------------------------
Bug #18751: Regression on master for Method#== when comparing public with private method
https://bugs.ruby-lang.org/issues/18751

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.0dev (2022-04-23T02:59:20Z master e142bea799) [x86_64-linux]
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
This script repros:
```ruby
class C
  class << self
    alias_method :n, :new
    private :new
  end
end

p C.method(:n) == C.method(:new) # => true

puts
p C.method(:n) == Class.method(:new) # => false
p C.method(:n) == Class.method(:new).unbind.bind(C) # => true

puts
p C.method(:new) == Class.method(:new) # => false
p C.method(:new) == Class.method(:new).unbind.bind(C) # => true, BUT false on master
p C.method(:new) == Class.instance_method(:new).bind(C) # => true, BUT false on master
p [C.method(:new), Class.instance_method(:new).bind(C)]
```

So this prints the expected results on 2.7.5, 3.0.3, 3.1.1 but not on master, which seems a regression.
Notably this breaks the pattern discussed in https://bugs.ruby-lang.org/issues/18729#note-5, and it means there is no way to find out if two methods share the same "definition/logic/def", which is a big limitation.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2022-12-01  5:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 11:39 [ruby-core:108378] [Ruby master Bug#18751] Regression on master for Method#== when comparing public with private method Eregon (Benoit Daloze)
2022-04-25 16:22 ` [ruby-core:108395] " jeremyevans0 (Jeremy Evans)
2022-04-25 17:19 ` [ruby-core:108396] " Eregon (Benoit Daloze)
2022-04-25 17:27 ` [ruby-core:108398] " Eregon (Benoit Daloze)
2022-05-17  6:51 ` [ruby-core:108577] " mame (Yusuke Endoh)
2022-05-17 10:00 ` [ruby-core:108581] " ioquatix (Samuel Williams)
2022-05-17 10:21 ` [ruby-core:108583] " Eregon (Benoit Daloze)
2022-05-17 15:41 ` [ruby-core:108596] " jeremyevans0 (Jeremy Evans)
2022-05-18  1:27 ` [ruby-core:108605] " mame (Yusuke Endoh)
2022-08-10  9:53 ` [ruby-core:109460] " Eregon (Benoit Daloze)
2022-08-15 13:22 ` [ruby-core:109486] " Eregon (Benoit Daloze)
2022-08-15 14:24 ` [ruby-core:109487] " Eregon (Benoit Daloze)
2022-08-18  9:30 ` [ruby-core:109540] " Eregon (Benoit Daloze)
2022-08-20 11:46 ` [ruby-core:109589] " Eregon (Benoit Daloze)
2022-08-20 12:06 ` [ruby-core:109591] " Eregon (Benoit Daloze)
2022-12-01  5:49 ` [ruby-core:111107] " matz (Yukihiro Matsumoto)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).