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

JS compiler error related to implicit return and return var type #11354

Closed
nitely opened this issue May 30, 2019 · 0 comments
Closed

JS compiler error related to implicit return and return var type #11354

nitely opened this issue May 30, 2019 · 0 comments

Comments

@nitely
Copy link
Contributor

nitely commented May 30, 2019

Example

type
  TrackySeq[T] = object
    s: seq[T]
    pos: int

proc foobar(ls: var TrackySeq[seq[int]], i: int): var seq[int] =
  echo ls.pos  # removing this, or making the return explicit works
  ls.s[i]

var foo: TrackySeq[seq[int]]
foo.s.add(@[0])
foo.foobar(0).add(1)
echo foo.s

Current Output

foob.nim(8, 3) Error: internal error: genAddr: nkStmtListExpr

Expected Output

0
@[@[0, 1]]
$ nim -v
Nim Compiler Version 0.19.9 [Linux: amd64]
Compiled at 2019-05-18
Copyright (c) 2006-2019 by Andreas Rumpf

active boot switches: -d:release
bung87 added a commit to bung87/Nim that referenced this issue Jul 26, 2020
…dr,nkStmtListExpr; genAsgn with lvalue tyVar and rvalue tyPtr
bung87 added a commit to bung87/Nim that referenced this issue Jul 26, 2020
@Araq Araq closed this as completed in cac09a4 Jul 27, 2020
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
…dr,nkStm… (nim-lang#15078)

* fix nim-lang#11354 jsgen not carefully handle genAddr with nkHiddenAddr,nkStmtListExpr; genAsgn with lvalue tyVar and rvalue tyPtr

* correct logic

* add test for nim-lang#11354

* handle nkHiddenAddr when n.len == 1

* Update compiler/jsgen.nim

* Update compiler/jsgen.nim

* Apply suggestions from code review

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
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

2 participants