summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-10-26 01:25:06 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-10-26 01:25:06 +0200
commit0c3e6735ac10c5ea77d0d63899528a819683431f (patch)
tree45e71670c8946378f0241b36dd4a2db7e5dd6754 /compiler/pragmas.nim
parent5b977627870d925e79dca1dd5cee615015314b5d (diff)
downloadNim-0c3e6735ac10c5ea77d0d63899528a819683431f.tar.gz
fixes #9358
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index c69da1813..08e3c34d4 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -949,10 +949,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
         recordPragma(c, it, "warning", s)
         message(c.config, it.info, warnUser, s)
       of wError:
-        if sym != nil and (sym.isRoutine or sym.kind == skType):
+        if sym != nil and (sym.isRoutine or sym.kind == skType) and wUsed in validPragmas:
           # This is subtle but correct: the error *statement* is only
-          # allowed for top level statements. Seems to be easier than
-          # distinguishing properly between
+          # allowed when 'wUsed' is not in validPragmas. Here this is the easiest way to
+          # distinguish properly between
           # ``proc p() {.error}`` and ``proc p() = {.error: "msg".}``
           if it.kind in nkPragmaCallKinds: discard getStrLitNode(c, it)
           incl(sym.flags, sfError)