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

fixes strictdefs with `when nimvm` #24409

Closed ringabout closed 3 weeks ago

ringabout commented 3 weeks ago

ref https://github.com/nim-lang/Nim/pull/24225 related https://github.com/nim-lang/Nim/pull/24306

Code in branches must not affect semantics of the code that follows the when nimvm statement. E.g. it must not define symbols that are used in the following code.

The test shouldn't have passed when https://github.com/nim-lang/Nim/pull/24306 would be implemented somehow. Some third packages have already misused when nimvm by defining symbols in the other branch of when nimvm.

e.g. in https://github.com/status-im/nim-unittest2/pull/34

when nimvm:
  discard
else:
  let suiteName {.inject.} = nameParam

use(suiteName)
github-actions[bot] commented 3 weeks ago

Thanks for your hard work on this PR! The lines below are statistics of the Nim compiler built from c71de10608b23bc2d9137d5cd48ee956e2adbfa8

Hint: mm: orc; opt: speed; options: -d:release 176769 lines; 8.712s; 653.602MiB peakmem