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

lent doesn't work in js iterators for most types #16908

Open
timotheecour opened this issue Feb 2, 2021 · 0 comments
Open

lent doesn't work in js iterators for most types #16908

timotheecour opened this issue Feb 2, 2021 · 0 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Feb 2, 2021

Example 1

when true:
  template main =
    iterator fn[T](a:T): lent T = yield a
    let a = @[10]
    for b in fn(a): echo b

  static: main()
  main()

Current Output

js+vm: @[10]
js+rt: @[]

Expected Output

js+vm: @[10]
js+rt: @[10]

Example 2

likewise, js+rt is broken with the following:

    # bugs:
    let a = "abc"
    # let a = "abc".cstring
    # let a = 12

    # ok:
    # let a = [1,2]
    # let a = (1,2)

a test fixing this should cover all those, and ideally more types.

Additional Information

1.5.1 fa9dc31

@timotheecour timotheecour changed the title lent doesn't work in js for seq lent doesn't work in js iterators for most types Feb 2, 2021
metagn added a commit to metagn/Nim that referenced this issue Jan 16, 2022
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

1 participant