Warn when redefining __id__ as well as object_id

[Feature #20912]
This commit is contained in:
John Hawthorn 2024-11-26 16:40:47 -08:00
parent a505cd32fb
commit f1dda5ed01
Notes: git 2024-11-30 04:41:19 +00:00
5 changed files with 11 additions and 8 deletions

View file

@ -11,8 +11,10 @@ describe "BasicObject#equal?" do
it "is unaffected by overriding __id__" do
o1 = mock("object")
o2 = mock("object")
def o1.__id__; 10; end
def o2.__id__; 10; end
suppress_warning {
def o1.__id__; 10; end
def o2.__id__; 10; end
}
o1.equal?(o2).should be_false
end