Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timotheecour opened this issue Oct 5, 2018 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Oct 5, 2018

[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

@krux02
Copy link
Contributor

krux02 commented Nov 1, 2018

Can you provide an example to this issue? At the moment I don't know how what code you would want to compile and what it should mean.

@timotheecour
Copy link
Member Author

timotheecour commented Nov 1, 2018

[EDIT]
/cc @krux02

Can you provide an example to this issue? At the moment I don't know how what code you would want to compile and what it should mean.

  • done, updated top-level msg
  • is the new label you added (Overload precedence) needed? (seems covered by "symbol resolution" no?)

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

No branches or pull requests

3 participants