misc fixes: remove forceConst (obsolete by static), add more runnableExamples to system (#17896)

* misc fixes

* add runnableExamples for compileOption

* add runnableExamples for runnableExamples

* move tconsteval => tconst

* cleanup
This commit is contained in:
Timothee Cour 2021-04-30 22:26:52 -07:00 • committed by GitHub
commit 82996aee3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 88 deletions

View file

@ -9,16 +9,6 @@ import os
import math
import strutils
template forceConst(a: untyped): untyped =
## Force evaluation at CT, useful for example here:
## `callFoo(forceConst(getBar1()), getBar2())`
## instead of:
## block:
## const a = getBar1()
## `callFoo(a, getBar2())`
const ret = a
ret
static:
# TODO: add more tests
block: #getAppFilename, gorgeEx, gorge
@ -51,6 +41,6 @@ static:
block:
# Check against bugs like #9176
doAssert getCurrentCompilerExe() == forceConst(getCurrentCompilerExe())
doAssert getCurrentCompilerExe() == getCurrentCompilerExe().static
if false: #pending #9176
doAssert gorgeEx("unexistant") == forceConst(gorgeEx("unexistant"))
doAssert gorgeEx("unexistant") == gorgeEx("unexistant").static