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

Newruntime: top-level string variable is empty after an array assignment #11614

Closed
ee7 opened this issue Jun 28, 2019 · 0 comments

Comments

@ee7
Copy link
Contributor

commented Jun 28, 2019

With --newruntime, a top-level let string variable becomes the empty string after an array assignment inside a proc.

Example

let a = "foo"

proc main =
  let b = [a]

main()
echo a == "foo"

Current Output

false

Expected Output

true

which is the output without --newruntime, or with --newruntime and any of these changes:

 let a = "foo"

 proc main =
-  let b = [a]
+  let b = @[a]

 main()
 echo a == "foo"
 let a = "foo"
-
-proc main =
-  let b = [a]
-
-main()
+let b = [a]
 echo a == "foo"
-let a = "foo"
+const a = "foo"

 proc main =
   let b = [a]

 main()
 echo a == "foo"
let a = "foo"

 proc main =
-  let b = [a]
+  doAssert [a] == ["foo"]

 main()
 echo a == "foo"

Additional Information

Nim 0.20.99, latest CI-passing devel commit d72edfb.

I don't know the current status of --newruntime, but I didn't see an issue that describes this behavior.

@Araq Araq closed this in 413dff0 Jul 1, 2019

narimiran added a commit that referenced this issue Jul 2, 2019

fixes #11614
(cherry picked from commit 413dff0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.