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

incremental compilation breaks strformat with enums #22226

Closed Rellikeht closed 1 year ago

Rellikeht commented 1 year ago

Description

This is minimal example of code that generates compile error when using --incremental:on

import strformat

type E = enum a

echo fmt"{a}"

Nim Version

Nim Compiler Version 1.9.5 [Linux: amd64] Compiled at 2023-07-05 Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 86ff37fab8656f7acd08fc9c3fa237f9e022dbf4 active boot switches: -d:release

Current Output

Error: 'newNimNode' can only be used in compile-time context

Expected Output

This should compile

Possible Solution

No response

Additional Information

It does that too on stable versions (1.6.x)

juancarlospaco commented 1 year ago

!nim c --incremental:on

import strformat
type E = enum a
echo fmt"{a}"
github-actions[bot] commented 1 year ago

@juancarlospaco (contributor)

devel :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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/.choosenim/toolchains/nim-#devel/lib/system/fatal.nim(52, 36) Error: internal error: '=destroy' operator not found for type string

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:40:52
  • Finished 2023-07-05T20:40:53
  • Duration 1 minute
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
stable :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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/.choosenim/toolchains/nim-1.6.14/lib/core/macros.nim(771, 22) Error: 'newNimNode' can only be used in compile-time context

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:40:54
  • Finished 2023-07-05T20:40:56
  • Duration 2 minutes
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
1.6.0 :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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/.choosenim/toolchains/nim-1.6.0/lib/core/macros.nim(755, 22) Error: 'newNimNode' can only be used in compile-time context

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:40:59
  • Finished 2023-07-05T20:41:00
  • Duration 2 minutes
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
1.4.0 :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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
command line(1, 2) Error: the compiler was not built with incremental compilation features; bootstrap with -d:nimIncremental to enable

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:41:04
  • Finished 2023-07-05T20:41:04
  • Duration now
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
1.2.0 :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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
command line(1, 2) Error: the compiler was not built with incremental compilation features; bootstrap with -d:nimIncremental to enable

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:41:19
  • Finished 2023-07-05T20:41:19
  • Duration now
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
1.0.0 :-1: FAIL

Output

Error: Command failed: nim c --incremental:on --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
command line(1, 2) Error: the compiler was not built with incremental compilation features; bootstrap with -d:nimIncremental to enable

Stats

  • Created 2023-07-05T20:40:18Z
  • Started 2023-07-05T20:41:29
  • Finished 2023-07-05T20:41:29
  • Duration now
  • Commands nim c --incremental:on --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( nnkImportStmt.newTree( newIdentNode("strformat") ), nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("E"), newEmptyNode(), nnkEnumTy.newTree( newEmptyNode(), newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("echo"), nnkCallStrLit.newTree( newIdentNode("fmt"), newLit("{a}") ) ) ) ```
:robot: Bug found in 40 minutes bisecting 6 commits at 0 commits per second.
Araq commented 1 year ago

Development of IC is on hold until 2.0 has been released. And we know it doesn't work, thanks.