diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index 5333e639cc94a..0fbdac562ec9e 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -77,7 +77,7 @@ proc initDefines*(symbols: StringTableRef) = defineSymbol("nimHasUserErrors") defineSymbol("nimUncheckedArrayTyp") defineSymbol("nimHasTypeof") - defineSymbol("nimErrorProcCanHaveBody") + defineSymbol("nimErrorProcCanHaveBody") # since #9665 but now unused defineSymbol("nimHasInstantiationOfInMacro") defineSymbol("nimHasHotCodeReloading") defineSymbol("nimHasNilSeqs") diff --git a/lib/pure/os.nim b/lib/pure/os.nim index d6f6aca5f53af..1a2f18010b9ad 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -74,8 +74,10 @@ elif defined(posix): else: {.error: "OS module not ported to your operating system!".} -when weirdTarget and defined(nimErrorProcCanHaveBody): - {.pragma: noNimScript, error: "this proc is not available on the NimScript target".} +when weirdTarget: + template noNimScript(body): untyped = discard + # Adding a `disable` template and `{.pragma: noNimScript, disable.}` + # doesn't work pending https://github.com/timotheecour/Nim/issues/142 else: {.pragma: noNimScript.} diff --git a/tests/test_nimscript.nims b/tests/test_nimscript.nims index 91b23efbfb2f7..5bdd5c02eaf04 100644 --- a/tests/test_nimscript.nims +++ b/tests/test_nimscript.nims @@ -1,6 +1,7 @@ # This nimscript is used to test if the following modules can be imported # http://nim-lang.org/docs/nims.html +{.push warning[UnusedImport]: off.} import algorithm import base64 import colors @@ -22,7 +23,16 @@ import unicode import uri import macros +# {.pop.} # xxx `pop` would resurface UnusedImport warnings + block: doAssert "./foo//./bar/".normalizedPath == "foo/bar".unixToNativePath echo "Nimscript imports are successful." + +block: # #14142 + discard existsDir("/usr") + discard dirExists("/usr") + discard existsFile("/usr/foo") + discard fileExists("/usr/foo") + discard findExe("nim")