summary refs log tree commit diff stats
path: root/compiler/semcall.nim
diff options
context:
space:
mode:
authorLancer11211 <109360848+Lancer11211@users.noreply.github.com>2022-07-26 07:40:49 +0200
committerGitHub <noreply@github.com>2022-07-26 07:40:49 +0200
commitefd5c571bf3de5c3b496be92fcf9a403898084f1 (patch)
tree96783d605424787dd811f5372152a4101800a395 /compiler/semcall.nim
parent62b81d7f109b2ec4b249a0abea121d7e0bc14d86 (diff)
downloadNim-efd5c571bf3de5c3b496be92fcf9a403898084f1.tar.gz
.forbids pragma: defining forbidden tags (#20050)
* .forbids pragma: defining illegal effects for proc types

This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc.

* updated documentation and changelogs for the forbids pragma

* renamed notTagEffects to forbiddenEffects

* corrected issues of forbids pragma

the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping

* removed incorrect character from changelog

* added test to cover the interaction of methods and the forbids pragma

* covering the interaction of the tags and forbids pragmas

* updated manual about the forbids pragma

* removed useless statement

* corrected the subtyping of proc types using the forbids pragma

* updated manual for the forbids pragma

* updated documentations for forbids pragma

* updated nim docs

* updated docs with rsttester.nim

* regenerated documentation

* updated rst docs

* Update changelog.md

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>

* updated changelog

* corrected typo

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Diffstat (limited to 'compiler/semcall.nim')
-rw-r--r--compiler/semcall.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semcall.nim b/compiler/semcall.nim
index 36658d472..4f956785e 100644
--- a/compiler/semcall.nim
+++ b/compiler/semcall.nim
@@ -154,6 +154,8 @@ proc effectProblem(f, a: PType; result: var string; c: PContext) =
             "proc with {.locks: 0.} to get extended error information."
       of efEffectsDelayed:
         result.add "\n  The `.effectsOf` annotations differ."
+      of efTagsIllegal:
+        result.add "\n  The `.forbids` requirements caught an illegal tag."
       when defined(drnim):
         if not c.graph.compatibleProps(c.graph, f, a):
           result.add "\n  The `.requires` or `.ensures` properties are incompatible."
@@ -730,4 +732,4 @@ proc searchForBorrowProc(c: PContext, startScope: PScope, fn: PSym): PSym =
         result = nil
       elif result.magic in {mArrPut, mArrGet}:
         # cannot borrow these magics for now
-        result = nil
\ No newline at end of file
+        result = nil