Skip to content

Exporting a toSeq overload messes up iterator visibility #512

@bluenote10

Description

@bluenote10
# file: main.nim
import sequtils
import tables

# this import messes up the functionality of table iterators
import b 

let t = initOrderedTable[int, int]()
let s = toSeq(keys(t))
echo s
# file: b.nim
type
  Data*[T] = object
    data*: seq[T]

proc toSeq*[T](c: Data[T]): seq[T] =
  c.data

Compiling main.nim results in: Error: attempting to call undeclared routine: 'keys'. Basically none of the iterators from tables can be used in a toSeq context when another module (accidentally) exports an overload of toSeq.

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