diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/pragmas.nim | 6 |
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) |