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

internal error: getTypeDescAux with void in generic array instantiation #23419

Closed
arnetheduck opened this issue Mar 18, 2024 · 4 comments · Fixed by #23550
Closed

internal error: getTypeDescAux with void in generic array instantiation #23419

arnetheduck opened this issue Mar 18, 2024 · 4 comments · Fixed by #23550

Comments

@arnetheduck
Copy link
Contributor

Description

import sequtils

type F[T, E] = object
  dummy: array[0, E]

proc stop(v: int): F[void, void] = discard

var b = mapIt([1, 2, 3], stop(it))

Nim Version

1.6, devel

Current Output

Error: internal error: getTypeDescAux(tyVoid)

Expected Output

No response

Possible Solution

No response

Additional Information

No response

@beef331
Copy link
Collaborator

beef331 commented Mar 18, 2024

Min repro

var a: (array[0, void], )

@juancarlospaco
Copy link
Collaborator

!nim c

var a: (array[0, void], )

Copy link
Contributor

🐧 Linux bisect by @juancarlospaco (collaborator)
devel 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
assertions.nim(34)       raiseAssert
Error: unhandled exception: errInternal [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:26
  • Finished 2024-03-31T16:50:26
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
stable 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(681, 5) `false` errInternal [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:26
  • Finished 2024-03-31T16:50:27
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
2.0.2 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(681, 5) `false` errInternal [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:27
  • Finished 2024-03-31T16:50:27
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
1.6.14 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(645, 14) `false` errInternal [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:30
  • Finished 2024-03-31T16:50:30
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
No stack traceback available
To create a stacktrace, rerun compilation with './koch temp c <file>', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:33
  • Finished 2024-03-31T16:50:33
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
1.2.18 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
No stack traceback available
To create a stacktrace, rerun compilation with ./koch temp c <file>

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:35
  • Finished 2024-03-31T16:50:35
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
1.0.10 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
Error: internal error: getTypeDescAux(tyVoid)
No stack traceback available
To create a stacktrace, rerun compilation with ./koch temp c <file>

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2024-03-31T16:50:37
  • Finished 2024-03-31T16:50:37
  • Duration

AST

nnkStmtList.newTree(
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      nnkTupleConstr.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("array"),
          newLit(0),
          newIdentNode("void")
        )
      ),
      newEmptyNode()
    )
  )
)
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 19.1
  • Created 2024-03-31T16:50:00Z
  • Comments 2
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 15 minutes bisecting 7 commits at 0 commits per second

@litlighilit
Copy link
Contributor

An array of void type is just not allowed1,

so the only thing that shall be improved is the error message.

Footnotes

  1. array[0, void] will gives Error: invalid type: 'void' in this context: 'array[0, void]', that's, the code above is invalid.

@ringabout ringabout self-assigned this Apr 30, 2024
Araq pushed a commit that referenced this issue May 1, 2024
…#23550)

fixes #23419

`void` is only supported as fields of objects/tuples. It shouldn't allow
void in the array.

I didn't merge it with taField because that flag is also used for
tyLent, which is allowed in the fields of other types.
narimiran pushed a commit that referenced this issue May 23, 2024
…#23550)

fixes #23419

`void` is only supported as fields of objects/tuples. It shouldn't allow
void in the array.

I didn't merge it with taField because that flag is also used for
tyLent, which is allowed in the fields of other types.

(cherry picked from commit 185e06c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants