zero-functional: createIter can't be fed to a proc: zero_functional.nim(1675, 16) Error: internal error: proc has no result symbol

import zero_functional
import strutils

when defined(case1):
  # error: /Users/timothee/.nimble/pkgs/zero_functional-#head/zero_functional.nim(1675, 16) Error: internal error: proc has no result symbol
  #    iterNode = quote:
  proc bar[T](a:T)=
    echo "in bar"
    for si in a():
      echo si

when defined(case2):
  # error
  proc bar[T](a:iterator: T {.inline.})=
    echo "in bar"
    for si in a():
      echo si

when defined(case3):
  # error
  proc bar(a:iterator: string {.inline.})=
    echo "in bar"
    for si in a():
      echo si

when defined(case4):
  # works
  template bar[T](a:T)=
    echo "in bar"
    for si in a():
      echo si

proc test()=
  lines(stdin) --> map(it.toUpper()) --> createIter(s)

  # BUG
  bar(s)

  # ok
  for si in s(): echo si

test()

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (10 by maintainers)

Most upvoted comments

@timotheecour Among a few other fixes and enhancements I created a new version 0.2.0 that also supports creating closures as default output type (in case when normally a sequence would be created) when the compile flag zf_iter is set. https://github.com/zero-functional/zero-functional/tree/v0.2.0#compile-flags

So - I guess this can be closed now?