Skip to content

overload resolution (with typed and untyped) doesn't work with iterators #9219

@timotheecour

Description

@timotheecour

[EDIT]
code below gives CT error, it should work instead.

#[
Error: attempting to call routine: 'myiter'
  found 't18_overload_untyped.myiter()[declared in t18_overload_untyped.nim(7, 9)]' of kind 'iterator'
  foo(myiter())
            ^
]#

# comment this to make code work
template foo(a: int) = echo "ok1"

template foo(a: untyped) = echo "ok2"

iterator myiter(): int=yield 0
foo(myiter())

See also my PR #8711 to have a universal toSeq: the untyped case is still needed to allow for inline iterators eg toSeq(keys(myTable))

EDIT note

this could either be fixed by nim-lang/RFCs#60

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