Skip to content

WeakKeyDict c-tor for Pairs is broken due to missing sizehint! #35782

Closed
@kshyatt

Description

@kshyatt

MWE:

julia> A = [1]; B = [2]; C = [3];

julia> WeakKeyDict{typeof(A), Int64}(Pair(A, 1), Pair(B, 2), Pair(C, 3))
hi
ERROR: MethodError: no method matching sizehint!(::WeakKeyDict{Array{Int64,1},Int64}, ::Int64)
Closest candidates are:
  sizehint!(::Array{T,1} where T, ::Integer) at array.jl:1092
  sizehint!(::IdDict, ::Any) at iddict.jl:59
  sizehint!(::Base.IdSet, ::Any) at idset.jl:23
  ...
Stacktrace:
 [1] WeakKeyDict{Array{Int64,1},Int64}(::Pair{Array{Int64,1},Int64}, ::Vararg{Pair{Array{Int64,1},Int64},N} where N) at ./weakkeydict.jl:45
 [2] top-level scope at REPL[2]:1

this is happening in this constructor which is currently untested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions