Skip to content

Confusing error message when calling toSeq using a non-iterator #7182

@dawkot

Description

@dawkot
import sequtils

type A = object
iterator items(self: A): int = discard
discard toSeq(A())  #type mismatch: got (seq[A], int)

This works:

discard toSeq(A().items)

Normally "toSeq" calls the "items" iterator if it finds one on it's own.

toSeq(1..10)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions