Skip to content

enumerateall yields no elements; collect returns #undef entries #999

Open

Description

@ParadaCarleton

enumerateall never yields an element, and collect returns a vector of #undef entries:

using DataStructures
md = MultiDict(1 => 2, 1 => 3, 5 => 6)
@show length(enumerateall(md)) iterate(enumerateall(md)) collect(enumerateall(md))

Output on master (b9ff234), Julia 1.13.3:

length(enumerateall(md)) = 3
iterate(enumerateall(md)) = nothing
collect(enumerateall(md)) = Any[#undef, #undef, #undef]

Cause, in src/multi_dict.jl:98-124:

  • dstate === nothing || vstate === nothing && return nothing parses as dstate === nothing || (vstate === nothing && return nothing). vs starts as an empty vector, so vstate is nothing and the first iterate returns nothing.
  • With the parentheses fixed, the two-argument method still returns vstate unchanged instead of calling iterate(vs, vst), so iteration would repeat the first value.

Related: #655.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions