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

strformat breaks with codeReordering enabled #22476

Open veryjos opened 1 year ago

veryjos commented 1 year ago

Description

# test.nim

import strformat

compiled with

nim c test.nim

Nim Version

Nim Compiler Version 2.1.1 [MacOSX: amd64] Compiled at 2023-08-07 Copyright (c) 2006-2023 by Andreas Rumpf

git hash: e7b4c7cddbefda0790b313062c0cfd233a259d6f active boot switches: -d:release

Current Output

/Users/jos/.choosenim/toolchains/nim-#devel/lib/pure/strformat.nim(649, 32) Error: undeclared identifier: 'formatValue'
candidates (edit distance, scope distance); see '--spellSuggest': 
 (4, 7): 'formatSize'

Expected Output

no errors

Possible Solution

No response

Additional Information

No response

veryjos commented 1 year ago

Happens on 2.0.0 as well

juancarlospaco commented 1 year ago

!nim c --experimental:codeReordering

import strformat
github-actions[bot] commented 1 year ago

@juancarlospaco (collaborator)

devel :-1: FAIL

Output

Error: Command failed: nim c --experimental:codeReordering --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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/pure/strformat.nim(649, 32) Error: undeclared identifier: 'formatValue'
candidates (edit distance, scope distance); see '--spellSuggest': 
 (4, 7): 'formatSize'

Stats

  • Started 2023-08-14T19:10:17
  • Finished 2023-08-14T19:10:18
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
stable :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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-2.0.0/lib/pure/strformat.nim(649, 32) Error: undeclared identifier: 'formatValue' candidates (edit distance, scope distance); see '--spellSuggest': (4, 7): 'formatSize' ```

Stats

  • Started 2023-08-14T19:10:19
  • Finished 2023-08-14T19:10:19
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
2.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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-2.0.0/lib/pure/strformat.nim(649, 32) Error: undeclared identifier: 'formatValue' candidates (edit distance, scope distance); see '--spellSuggest': (4, 7): 'formatSize' ```

Stats

  • Started 2023-08-14T19:10:20
  • Finished 2023-08-14T19:10:20
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
1.6.0 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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/pure/strformat.nim(635, 32) Error: undeclared identifier: 'formatValue' candidates (edit distance, scope distance); see '--spellSuggest': (4, 7): 'formatSize' [func declared in /home/runner/.choosenim/toolchains/nim-1.6.0/lib/pure/strutils.nim(2459, 6)] ```

Stats

  • Started 2023-08-14T19:10:23
  • Finished 2023-08-14T19:10:24
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
1.4.0 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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.4.0/lib/pure/strformat.nim(621, 32) Error: undeclared identifier: 'formatValue' ```

Stats

  • Started 2023-08-14T19:10:27
  • Finished 2023-08-14T19:10:28
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
1.2.0 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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.2.0/lib/pure/strformat.nim(566, 32) Error: undeclared identifier: 'formatValue' ```

Stats

  • Started 2023-08-14T19:10:44
  • Finished 2023-08-14T19:10:44
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
1.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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.0.0/lib/pure/strformat.nim(560, 32) Error: undeclared identifier: 'formatValue' ```

Stats

  • Started 2023-08-14T19:10:57
  • Finished 2023-08-14T19:10:57
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
0.20.2 :-1: FAIL

Output

``` Error: Command failed: nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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-0.20.2/lib/pure/strformat.nim(560, 32) Error: undeclared identifier: 'formatValue' ```

Stats

  • Started 2023-08-14T19:11:08
  • Finished 2023-08-14T19:11:08
  • Duration

IR

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

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("strformat") ) ) ```
Stats
  • GCC 11.4.0
  • LibC 2.35
  • Valgrind 3.18.1
  • NodeJS 17.0
  • Linux 5.15.0
  • Created 2023-08-14T19:09:43Z
  • Comments 2
  • Commands nim c --experimental:codeReordering --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors: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
:robot: Bug found in 54 minutes bisecting 8 commits at 0 commits per second.
juancarlospaco commented 1 year ago

codeReordering is not aware of macros AFAIU.