Fix some #eql? correctness issues
The implementation of #eql? and #hash should ensure that if a.eql?(b), then a.hash == b.hash, but #eql? itself should not *depend* on #hash. For example, given class Thingy def eql? instance_of?(other.class) && hash == other.hash end def hash [name, *tags].hash end end if #hash produces a collision for different values of [name, *tags], two Thingy objects will appear to be eql?, even though this is not the case. Instead, #eql? should depend on the equality of name and tags directly.
Showing
- Library/Homebrew/dependency.rb 1 addition, 1 deletionLibrary/Homebrew/dependency.rb
- Library/Homebrew/options.rb 1 addition, 1 deletionLibrary/Homebrew/options.rb
- Library/Homebrew/requirement.rb 1 addition, 1 deletionLibrary/Homebrew/requirement.rb
- Library/Homebrew/test/test_requirement.rb 14 additions, 0 deletionsLibrary/Homebrew/test/test_requirement.rb
Loading
Please register or sign in to comment