ActionsLike0
Bug #9381
closed2.1.0 Regression. Hash lookup with #hash and #eql?
Description
Ruby 2.1.0 won't fetch objects when the lookup key overrides #hash
and #eql?
.
This is a regression as it works as expected in ruby 1.8, 1.9 and 2.0.
class Wrapper
def initialize(obj)
@obj = obj
end
def method_missing(symbol, *args, &block)
@obj.__send__(symbol, *args, &block)
end
def hash
@obj.hash
end
def eql?(other)
@obj.eql?(other)
end
end
hash = { 5 => "LOOKUP SUCCEEDED" }
# Prints "LOOKUP SUCCEEDED" on RUBY < 2.1.0. Fails on RUBY 2.1.0.
p hash[Wrapper.new(5)]
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
- Description updated (diff)
- Status changed from Open to Assigned
- Assignee set to nobu (Nobuyoshi Nakada)
- Target version set to 2.2.0
- Backport changed from 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Updated by naruse (Yui NARUSE) about 11 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE
Updated by nobu (Nobuyoshi Nakada) about 11 years ago
- Description updated (diff)
Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED
Updated by nagachika (Tomoyuki Chikanaga) over 9 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE
Updated by usa (Usaku NAKAMURA) over 9 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: REQUIRED, 2.2: DONE to 1.9.3: DONTNEED, 2.0.0: DONTNEED, 2.1: DONE, 2.2: DONE
ActionsLike0