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.55k stars 1.47k forks source link

Empty array literal in tuple crashes compiler in codegen #21599

Open al6x opened 1 year ago

al6x commented 1 year ago

Description

Code below would crush compiler, play

echo ("div", "#post", [])

Nim Version

Nim Compiler Version 1.6.12 [MacOSX: amd64] Compiled at 2023-03-10 Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release -d:nimUseLinenoise

Current Output

Error: internal error: getTypeDescAux(tyEmpty)
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

Expected Output

No response

Possible Solution

No response

Additional Information

No response

pietroppeter commented 1 year ago

I think the expected output should be to error with Error: cannot infer the type of the array which is the output of:

let a = []
juancarlospaco commented 1 year ago

!nim c

echo ([], )
github-actions[bot] commented 1 year ago

@juancarlospaco (contributor)

devel :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings: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(tyEmpty)
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

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:00
  • Finished 2023-07-11T18:59:00
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
stable :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings: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(tyEmpty)
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

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:01
  • Finished 2023-07-11T18:59:01
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
1.6.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings: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(tyEmpty)
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

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:04
  • Finished 2023-07-11T18:59:05
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
1.4.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings: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(tyEmpty)
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

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:07
  • Finished 2023-07-11T18:59:07
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
1.2.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings: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(tyEmpty)
No stack traceback available
To create a stacktrace, rerun compilation with ./koch temp c <file>

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:23
  • Finished 2023-07-11T18:59:23
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
1.0.0 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off  --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(1, 6) template/generic instantiation of `$` from here
/home/runner/.choosenim/toolchains/nim-1.0.0/lib/system/dollars.nim(75, 46) template/generic instantiation of `isNamedTuple` from here
/home/runner/.choosenim/toolchains/nim-1.0.0/lib/system/dollars.nim(57, 9) Error: invalid type: 'empty' in this context: 'tuple of (array[0..-1, empty])' for var

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:36
  • Finished 2023-07-11T18:59:37
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
0.20.2 :-1: FAIL

Output

Error: Command failed: nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off  --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(1, 6) template/generic instantiation of `$` from here
/home/runner/.choosenim/toolchains/nim-0.20.2/lib/system/dollars.nim(75, 46) template/generic instantiation of `isNamedTuple` from here
/home/runner/.choosenim/toolchains/nim-0.20.2/lib/system/dollars.nim(57, 9) Error: invalid type: 'empty' in this context: 'tuple of (array[0..-1, empty])' for var

Stats

  • Created 2023-07-11T18:58:24Z
  • Started 2023-07-11T18:59:48
  • Finished 2023-07-11T18:59:48
  • Duration now
  • Commands nim c --run -d:strip -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --threads:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

IR

```cpp ```

AST

```nim nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), nnkTupleConstr.newTree( nnkBracket.newTree( ) ) ) ) ```
:robot: Bug found in 52 minutes bisecting 7 commits at 0 commits per second.