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

sugar.collect can't be used in templates #14332

Closed
dawkot opened this issue May 13, 2020 · 2 comments
Closed

sugar.collect can't be used in templates #14332

dawkot opened this issue May 13, 2020 · 2 comments

Comments

@dawkot
Copy link

dawkot commented May 13, 2020

Example

import sugar

template foo =
  discard collect(newSeq, for i in 1..3: i)

foo()

Current Output

Error: type mismatch: got <>
        ... but expected one of: 
        ... proc (s: var seq[int], len: Natural){.noSideEffect.}

Additional Information

  • Nim 1.2.0
@Araq
Copy link
Member

Araq commented May 13, 2020

Workaround:

import sugar

template foo {.dirty.} =
  discard collect(newSeq, for i in 1..3: i)

foo()

@planetis-m
Copy link
Contributor

Fixed by #16089

@Araq Araq closed this as completed in 808ab7e Dec 3, 2020
timotheecour pushed a commit to timotheecour/Nim that referenced this issue Dec 3, 2020
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants