From: Marc-Andre Lafortune Date: 2009-02-17T05:10:51+09:00 Subject: [ruby-core:22190] [Bug #1165] Range.eql? and Range.== bug with subclasses Bug #1165: Range.eql? and Range.== bug with subclasses http://redmine.ruby-lang.org/issues/show/1165 Author: Marc-Andre Lafortune Status: Open, Priority: Normal Category: core, Target version: 1.9.x ruby -v: ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0] Contrary to the documentation (and to what I would expect): class TrivialRangeSubclass < Range end TrivialRangeSubclass.new(0,1) == Range.new(0,1) # ==> false This bug is present in the current versions of ruby 1.8.7 and 1.9.1. As a matter of curiosity, I checked both JRuby (1.1.6) and rubinius (0.10.0) and they both return true (as they should). Although I'm not familiar with the source code, it seams like a simple change, so I've included a patch for the 1.9.1 version. I hope I did things correctly! Changelog could read like: Mon Feb 16 14:35:35 2009 Marc-Andre Lafortune * range.c (range_eql, range_eq): fixed equality to work for subclasses of Range. * test/ruby/test_range.rb: add assertions for above. Thank you! ---------------------------------------- http://redmine.ruby-lang.org