Issue #11035 has been updated by Tomoyuki Chikanaga.

Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE

Backported into `ruby_2_2` branch at rr50620.

----------------------------------------
Bug #11035: Calling #hash method: inconsistency between dynamic and static symbols
https://bugs.ruby-lang.org/issues/11035#change-52596

* Author: Koichi Sasada
* Status: Closed
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: 2.3dev
* Backport: 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE
----------------------------------------
There is an inconsistency between static symbols and dynamic symbols.

```ruby
class Symbol
  def hash
    raise
  end
end

h = {}
h[:foo] = 1          #=> no problem
h['bar'.to_sym] = 2  #=> unhandled exception
```

I think it should be same behavior.
My favorite is skip calling #hash for all Symbol objects.





-- 
https://bugs.ruby-lang.org/