nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.44k stars 1.47k forks source link

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

Closed arnetheduck closed 4 months ago

arnetheduck commented 6 months ago

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 commented 6 months ago

Min repro

var a: (array[0, void], )
juancarlospaco commented 5 months ago

!nim c

var a: (array[0, void], )
github-actions[bot] commented 5 months ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: 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) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
stable :-1: 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) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
2.0.2 :-1: 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) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
1.6.14 :-1: 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) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
1.4.8 :-1: 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 ', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
1.2.18 :-1: 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 ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

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

AST

```nim nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("a"), nnkTupleConstr.newTree( nnkBracketExpr.newTree( newIdentNode("array"), newLit(0), newIdentNode("void") ) ), newEmptyNode() ) ) ) ```
1.0.10 :-1: 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 ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

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

AST

```nim 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

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

litlighilit commented 5 months ago

An array of void type is just not allowed[^1],

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

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