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

Empty array literal in tuple crashes compiler in codegen #21599

Open
al6x opened this issue Apr 2, 2023 · 3 comments
Open

Empty array literal in tuple crashes compiler in codegen #21599

al6x opened this issue Apr 2, 2023 · 3 comments
Labels
Compiler Crash Error Messages Invalid Code Acceptance Everything related to compiler not complaining about invalid code

Comments

@al6x
Copy link

al6x commented Apr 2, 2023

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
Copy link
Collaborator

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 = []

@github-actions github-actions bot added the stale Staled PR/issues; remove the label after fixing them label Jun 2, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 9, 2023
@ringabout ringabout removed the stale Staled PR/issues; remove the label after fixing them label Jun 9, 2023
@ringabout ringabout reopened this Jun 9, 2023
@juancarlospaco
Copy link
Collaborator

!nim c

echo ([], )

@github-actions
Copy link
Contributor

@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

AST

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

AST

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

AST

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

AST

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

AST

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

AST

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

AST

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

@metagn metagn changed the title Minor compiler error Empty array literal in tuple crashes compiler in codegen Aug 28, 2023
@metagn metagn added Compiler Crash Invalid Code Acceptance Everything related to compiler not complaining about invalid code labels Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler Crash Error Messages Invalid Code Acceptance Everything related to compiler not complaining about invalid code
Projects
None yet
Development

No branches or pull requests

5 participants