Files
Nim/tests/ic/minitorderb.nim
2026-07-03 15:52:41 +02:00

16 lines
468 B
Nim

# Helper for tinitorder (not a test itself; no `discard`).
#
# An imported module whose INIT sets module-level state at runtime. Under the
# per-module backend its init must run BEFORE any importer's init (the imported
# module is a dependency → post-order). With the buggy importer-first order this
# module's `setupB` runs too late and importers observe `gBState == 0`.
var gBState: int
proc getBState*(): int = gBState
proc setupB() =
gBState = 42
setupB()