Skip to content

Commit 93ec635

Browse files
authored
Add Integer type annotation to sizehint! overloads (#945)
1 parent 64d3a76 commit 93ec635

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/ordered_robin_dict.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ function rehash!(h::OrderedRobinDict{K, V}) where {K, V}
170170
return h
171171
end
172172

173-
function Base.sizehint!(d::OrderedRobinDict, newsz)
173+
function Base.sizehint!(d::OrderedRobinDict, newsz::Integer)
174174
oldsz = length(d)
175175
# grow at least 25%
176176
if newsz < (oldsz*5)>>2
@@ -232,7 +232,7 @@ end
232232
function Base.get!(default::Base.Callable, h::OrderedRobinDict{K,V}, key0) where {K,V}
233233
index = get(h.dict, key0, -2)
234234
index > 0 && return @inbounds h.vals[index]
235-
235+
236236
v = convert(V, default())
237237
setindex!(h, v, key0)
238238
return v

src/robin_dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ function rehash!(h::RobinDict{K,V}, newsz = length(h.keys)) where {K, V}
225225
return h
226226
end
227227

228-
function Base.sizehint!(d::RobinDict, newsz)
228+
function Base.sizehint!(d::RobinDict, newsz::Integer)
229229
newsz = _tablesz(newsz*2) # *2 for keys and values in same array
230230
oldsz = length(d.keys)
231231
# grow at least 25%

src/swiss_dict.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function maybe_rehash_shrink!(h::SwissDict)
274274
end
275275
end
276276

277-
function Base.sizehint!(d::SwissDict, newsz)
277+
function Base.sizehint!(d::SwissDict, newsz::Integer)
278278
newsz = _tablesz(newsz*2) # *2 for keys and values in same array
279279
oldsz = length(d.keys)
280280
# grow at least 25%

0 commit comments

Comments
 (0)