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

compiler/nimeval can't be used twice: fails 2nd time with: Error: internal error: n is not nil #9180

Closed
timotheecour opened this issue Oct 4, 2018 · 4 comments · Fixed by #9181
Labels

Comments

@timotheecour
Copy link
Member

timotheecour commented Oct 4, 2018

/cc @Araq
env var nimc_D points to compile git repo

import compiler / [ast, vmdef, vm, nimeval, llstream]
from os import getEnv
proc evalString(code: string, moduleName = "script.nim"):auto=
  let stream = llStreamOpen(code)
  defer: llStreamClose(stream)
  let path = getEnv("nimc_D") & "/lib/"
  var intr = createInterpreter(moduleName, [path])
  defer: destroyInterpreter(intr)
  intr.evalScript(stream)

evalString("echo 1")
evalString("echo 2")
rnim bugs/nimeval/t03_n_is_not_nil.nim
nim c --nimcache:/tmp/nim//nimcache/ -o:/tmp/nim//app -r bugs/nimeval/t03_n_is_not_nil.nim
1
???(0, 0) Error: internal error: n is not nil
Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/bugs/nimeval/t03_n_is_not_nil.nim(13) t03_n_is_not_nil
/Users/timothee/git_clone/nim/timn/bugs/nimeval/t03_n_is_not_nil.nim(8) evalString
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/nimeval.nim(115) createInterpreter
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/modules.nim(107) compileSystemModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/modules.nim(71) compileModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/passes.nim(220) processModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/passes.nim(95) closePasses
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/sem.nim(626) myClose
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(524) internalError
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(495) liMessage
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(324) handleError
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(314) quit
Error: execution of an external program failed: '/tmp/nim//app '

EDIT
/cc @alaviss
looks suspiciously similar to [1] which was fixed by @alaviss

[1] running runNimScript on 2 subsequent nims files causes "Error: internal error: n is not nil" #8235

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 4, 2018
@alaviss
Copy link
Collaborator

alaviss commented Oct 4, 2018

See #9068

@timotheecour
Copy link
Member Author

timotheecour commented Oct 4, 2018

yes; I saw the thread, a better fix may indeed be to address #9068; but I'll let someone more familiar with that code do the proper fix; until then #9181 fixes this issue so I'd like it to be merged

@alaviss
Copy link
Collaborator

alaviss commented Oct 10, 2018

@timotheecour Can you confirm that #9259 fixed this issue? If so please close it.

@timotheecour
Copy link
Member Author

timotheecour commented Oct 10, 2018

it fixes it but there's still not test case for it; I've just renamed #9181 to reflect the fact that #9259 was merged in the meantime; I think it's better to close once the test case is merged, so let's wait for #9181 to close this

Araq pushed a commit that referenced this issue Oct 11, 2018
)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for #9180

* address comments
krux02 pushed a commit to krux02/Nim that referenced this issue Oct 15, 2018
…test (nim-lang#9181)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for nim-lang#9180

* address comments
narimiran pushed a commit to narimiran/Nim that referenced this issue Oct 31, 2018
…test (nim-lang#9181)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for nim-lang#9180

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants