Skip to content

Commit

Permalink
Merge pull request #41 from andyferris/ajf/fix-promote_type
Browse files Browse the repository at this point in the history
Fix usage of promote_type in _dictionary
  • Loading branch information
andyferris authored Jan 6, 2021
2 parents a9db3e1 + 65e24b7 commit 48a4bb8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Dictionary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ function __dictionary(key, value, dict, iter, s)
(x, s) = tmp
i = key(x)
v = value(x)
if !(i isa I)
if !(i isa I) && promote_type(typeof(i), I) != I
new_inds = copy(keys(dict), promote_type(I, typeof(i)))
new_dict = similar(new_inds, promote_type(T, typeof(v)))
(hadtoken, token) = gettoken!(new_dict, i)
if !hadtoken
@inbounds settokenvalue!(new_dict, token, v)
end
return __dictionary(key, value, new_dict, iter, s)
elseif !(v isa T)
elseif !(v isa T) && promote_type(typeof(v), T) != T
new_dict = copy(dict, promote_type(T, typeof(v)))
(hadtoken, token) = gettoken!(new_dict, i)
if !hadtoken
Expand Down

0 comments on commit 48a4bb8

Please sign in to comment.