Skip to content

for n in set: HashSet is not iterable #2183

Closed

Description

@ehartford

Spec §13.5 (a collection is a for iterable); D44 (traversal observes).

use std.collections
var s: HashSet[i32] = HashSet.new()
s.insert(3)
s.insert(1)
for n in s: print(n)

Expected: prints each element (&i32), in insertion order (D96).
Actual: cannot iterate over HashSet[i32] (§13.5). HashSet has no iter() either.
Found while implementing D96.

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