IC: added tcompiletime_counter test case (#17698)

This commit is contained in:
Andreas Rumpf 2021-04-11 21:41:24 +02:00 • committed by GitHub
commit cae1839154
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import std/macros
import std/macrocache
const myCounter = CacheCounter"myCounter"
proc getUniqueId*(): int {.compileTime.} =
inc myCounter
result = myCounter.value
static:
myCounter.inc(3)
assert myCounter.value == 3