summary refs log tree commit diff stats
path: root/tests/arc/twrong_sinkinference.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arc/twrong_sinkinference.nim')
-rw-r--r--tests/arc/twrong_sinkinference.nim18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/arc/twrong_sinkinference.nim b/tests/arc/twrong_sinkinference.nim
new file mode 100644
index 000000000..ecf09d28a
--- /dev/null
+++ b/tests/arc/twrong_sinkinference.nim
@@ -0,0 +1,18 @@
+discard """
+  cmd: "nim c --gc:arc $file"
+  errormsg: "type mismatch: got <proc (a: string, b: sink string){.noSideEffect, gcsafe.}>"
+  line: 18
+"""
+
+type
+  Foo = proc (a, b: string)
+
+proc take(x: Foo) =
+  x("a", "b")
+
+proc willSink(a, b: string) = # {.nosinks.} =
+  var arr: array[3, string]
+  var x = a
+  arr[0] = b
+
+take willSink