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

Cannot instantiate T from => in generic #7399

Closed
bluenote10 opened this issue Mar 23, 2018 · 2 comments
Closed

Cannot instantiate T from => in generic #7399

bluenote10 opened this issue Mar 23, 2018 · 2 comments

Comments

@bluenote10
Copy link
Contributor

There seems to be an issue with future's => and generics:

import sequtils, future

proc f*[T](x: T) =
  let other = @[1, 2, 3]
  var mapped = toSeq(0 ..< other.len).map(i => (other[i], i))

f(1)

Produces: lib/system.nim(3549, 14) Error: cannot instantiate: 'T'

The issue disappears:

  • when f is not generic
  • when using other expressions like i => (i, i)
  • when writing the expression verbosely toSeq(0 ..< other.len).map(proc(i: int): (int, int) = (other[i], i))
@timotheecour
Copy link
Member

#8679 will fix this

@bluenote10
Copy link
Contributor Author

I think I reported this twice because I keep forgetting about the limitations ;).

Closing in favor of #7816

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