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

NimVM generic procs that take anonymous tuples gives nil access error. #15662

Closed
beef331 opened this issue Oct 20, 2020 · 2 comments · Fixed by #15678
Closed

NimVM generic procs that take anonymous tuples gives nil access error. #15662

beef331 opened this issue Oct 20, 2020 · 2 comments · Fixed by #15678
Labels
VM see also `const` label

Comments

@beef331
Copy link
Collaborator

beef331 commented Oct 20, 2020

When using T: typedesc and passing a anonymous tuple the NimVM is incapable of running the code

Example

static:
  proc a(T: typedesc)= echo T.type
  a(float)
  a((int, int))

Current Output

float
stack trace: (most recent call last)
/usercode/in.nim(4, 6)   in
/usercode/in.nim(4, 6) Error: attempt to access a nil address

Expected Output

float
(int, int)

Nim version

Nim Compiler Version 1.4.0 [Linux: amd64]
Compiled at 2020-10-16
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 018ae963ba83934a68d815c3c1c44c06e8ec6178
@Yardanico Yardanico added the VM see also `const` label label Oct 20, 2020
@cooldome
Copy link
Member

I have a fix for this one

cooldome added a commit that referenced this issue Oct 22, 2020
@cooldome cooldome mentioned this issue Oct 22, 2020
Araq pushed a commit that referenced this issue Oct 23, 2020
* fix #15662

* alternative fix

* fix spacing
@beef331
Copy link
Collaborator Author

beef331 commented Oct 24, 2020

With the fix I now have the same issue with the following. Starting to think might be wise to just avoid anonymous tuples for Nimscripter. 😄

static:
  proc test[T](t: typedesc[T]): T =
    discard
  echo test((int, int))

narimiran pushed a commit that referenced this issue Oct 24, 2020
* fix #15662

* alternative fix

* fix spacing

(cherry picked from commit ae320b4)
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
* fix nim-lang#15662

* alternative fix

* fix spacing
irdassis pushed a commit to irdassis/Nim that referenced this issue Mar 16, 2021
* fix nim-lang#15662

* alternative fix

* fix spacing
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
* fix nim-lang#15662

* alternative fix

* fix spacing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VM see also `const` label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants