Project

General

Profile

Bug #20307

Updated by nobu (Nobuyoshi Nakada) 3 months ago

I don't think this behavior is expected. 

 ```ruby 
 i = Hash.new.compare_by_identity 
 k = "a" 
 i[k] = 0 
 h = {}.update(i) 
 p h.compare_by_identity?    # => false 
 p h["a"]                    # => 0 

 k.upcase! 
 # `k` is still in `h`. 
 p h.keys.include?(k)        # => true 

 # but not found. 
 p((h.fetch(k) rescue $!)) # => #<KeyError: key not found: "A"> 
 h["A"] = 1   
 p h                         # => {"A"=>0, "A"=>1} 
 ``` 

 I expect that `h.fetch(k)` returns `0` and `h` to still have `"a"=>0` has just one entry. 

Back