summary refs log tree commit diff stats
path: root/tests/effects
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-10-15 20:07:40 +0800
committerGitHub <noreply@github.com>2022-10-15 14:07:40 +0200
commit1e15f975b83951006d69e6e39836aa2d525028c4 (patch)
treed43b2b539494a46df310d91d565c9858e6dcb0b9 /tests/effects
parent0510a2be0d6df674aa91ae3f2884d98473cade4c (diff)
downloadNim-1e15f975b83951006d69e6e39836aa2d525028c4.tar.gz
fixes #19162; enable `strictEffects` for v2 (#19380)
* enable stricteffects
* add gcsafe
* fix tests
* use func
* fixes pegs tests
* explicitly mark repr related procs with noSideEffect
* add nimLegacyEffects
* change URL
* fixes docopt
* add `raises: []` to repr
* fixes weave
* fixes nimyaml
* fixes glob
* fixes parsetoml
* Apply suggestions from code review
* Update testament/important_packages.nim
* add legacy:laxEffects
Diffstat (limited to 'tests/effects')
-rw-r--r--tests/effects/teffects6.nim2
-rw-r--r--tests/effects/tgcsafe.nim4
-rw-r--r--tests/effects/tnosideeffect.nim2
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/effects/teffects6.nim b/tests/effects/teffects6.nim
index 4a39e0dca..d3af22434 100644
--- a/tests/effects/teffects6.nim
+++ b/tests/effects/teffects6.nim
@@ -21,7 +21,7 @@ createMenuItem(s, "Go to definition...",
 )
 
 
-proc noRaise(x: proc()) {.raises: [].} =
+proc noRaise(x: proc()) {.raises: [], effectsOf: x.} =
   # unknown call that might raise anything, but valid:
   x()
 
diff --git a/tests/effects/tgcsafe.nim b/tests/effects/tgcsafe.nim
index 363624f19..cfac3ddd8 100644
--- a/tests/effects/tgcsafe.nim
+++ b/tests/effects/tgcsafe.nim
@@ -1,5 +1,5 @@
 discard """
-  errormsg: "'mainUnsafe' is not GC-safe"
+  errormsg: "'mainUnsafe' is not GC-safe as it performs an indirect call here"
   line: 26
   cmd: "nim $target --hints:on --threads:on $options $file"
 """
@@ -13,7 +13,7 @@ proc myproc(i: int) {.gcsafe.} =
   if isNil(global_proc):
     return
 
-proc mymap(x: proc ()) =
+proc mymap(x: proc ()) {.effectsOf: x.} =
   x()
 
 var
diff --git a/tests/effects/tnosideeffect.nim b/tests/effects/tnosideeffect.nim
index 9cabb35a2..9fc2f74d4 100644
--- a/tests/effects/tnosideeffect.nim
+++ b/tests/effects/tnosideeffect.nim
@@ -1,5 +1,5 @@
 block: # `.noSideEffect`
-  func foo(bar: proc(): int): int = bar()
+  func foo(bar: proc(): int): int {.effectsOf: bar.} = bar()
   var count = 0
   proc fn1(): int = 1
   proc fn2(): int = (count.inc; count)