diff --git a/base/abstractdict.jl b/base/abstractdict.jl index c523a25cecd3f0..ab1ad2464cb4c2 100644 --- a/base/abstractdict.jl +++ b/base/abstractdict.jl @@ -536,12 +536,12 @@ function hash(a::AbstractDict, h::UInt) hash(hv, h) end -function getindex(t::AbstractDict, key) +function getindex(t::AbstractDict{<:Any,V}, key) where V v = get(t, key, secret_table_token) if v === secret_table_token throw(KeyError(key)) end - return v + return v::V end # t[k1,k2,ks...] is syntactic sugar for t[(k1,k2,ks...)]. (Note