JuliaLang/julia — pull request #4166 by simonster (2013-08-28 00:47:26+00:00)
Title: Convert key to Dict key type before hashing

After fc05d74d0bd2117c8691e68e751ee9b212a5d3a2:

```julia
julia> a = Dict{Int16, Any}()
Dict{Int16,Any}()

julia> a[1] = 1
1

julia> a[1]
ERROR: key not found: 1
in getindex at dict.jl:486
```

This is because `setindex()` calls `convert()` on the key but `getindex()` does not. This PR calls `convert()` in `ht_keyindex()`, which fixes this. I wrapped this in `try`/`catch` so that `get()`/`getkey()` won't throw when `convert(::KeyType, ::DictKeyType)` doesn't exist.