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

Nimble doesn't work with --gc:arc #798

Closed
ghost opened this issue May 4, 2020 · 0 comments · Fixed by #802
Closed

Nimble doesn't work with --gc:arc #798

ghost opened this issue May 4, 2020 · 0 comments · Fixed by #802

Comments

@ghost
Copy link

ghost commented May 4, 2020

Just to store the info:

nimble.nim:416 - need to add nosinks like

proc (file: string) {.nosinks.} =

download.nim:113 - need to do the same

.map(proc(s: string): tuple[ver: Version, tag: string] {.nosinks.} =

and the most important one - Nimble relies on the fact that after catching the exception the variable initialized in the "try" block still contains useful info (for validation), as shown in packageparser.nim, or for shorter example:

type
  PackageInfo* = object
    myPath*: string ## The path of this .nimble file

proc readPackageInfo(): PackageInfo = 
  result = PackageInfo(mypath: "testlol")
  if result.mypath == "testlol":
    raise newException(ValueError, "testlol")
  echo result.mypath

proc getPkgInfoFromFile*(): PackageInfo =
  ## Reads the specified .nimble file and returns its data as a PackageInfo
  ## object. Any validation errors are handled and echoed as warnings.
  try:
    result = readPackageInfo()
  except ValueError:
    echo "error"
  echo "getPkgInfoFromFile:"
  echo result.mypath

proc getPkgInfo*(): PackageInfo = 
  return getPkgInfoFromFile()

proc downloadPkg*() = 
  let pkginfo = getPkgInfo()
  echo pkginfo.mypath

downloadPkg()

I think this can be considered as relying on undefined behaviour, so this probably should be changed (store PackageInfo as the field in ValidationError ?)

dom96 pushed a commit that referenced this issue May 19, 2020
* Initial attempt at fixing #798

* Fix getInstalledPkgs

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

Successfully merging a pull request may close this issue.

0 participants