diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-04-29 21:58:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 21:58:59 +0200 |
commit | d9e907c0e2a58630f7b57c0afbe51c05fcf6b3ab (patch) | |
tree | ee7ad5e4bf27372a763dda5426dcd3ebdb4bc9f0 /tests/arc | |
parent | 707367e1ca231d964ba82a92b642eb5efdc1aa7c (diff) | |
download | Nim-d9e907c0e2a58630f7b57c0afbe51c05fcf6b3ab.tar.gz |
fixes #14079 [backport:1.2] (#14163)
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/tarcmisc.nim | 14 | ||||
-rw-r--r-- | tests/arc/twrong_sinkinference.nim | 18 |
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/arc/tarcmisc.nim b/tests/arc/tarcmisc.nim index 963ae9806..ce8e902c6 100644 --- a/tests/arc/tarcmisc.nim +++ b/tests/arc/tarcmisc.nim @@ -46,7 +46,7 @@ type proc `=destroy`(x: var AObj) = close(x.io) echo "closed" - + var x = B(io: newStringStream("thestream")) @@ -64,4 +64,14 @@ proc main() = cryptCTR(nonce2.toOpenArray(0, nonce2.len-1)) doAssert(nonce2 == "0A234567") -main() \ No newline at end of file +main() + +# bug #14079 +import std/algorithm + +let + n = @["c", "b"] + q = @[("c", "2"), ("b", "1")] + +assert n.sortedByIt(it) == @["b", "c"], "fine" +assert q.sortedByIt(it[0]) == @[("b", "1"), ("c", "2")], "fails under arc" diff --git a/tests/arc/twrong_sinkinference.nim b/tests/arc/twrong_sinkinference.nim new file mode 100644 index 000000000..59930a9fa --- /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, locks: 0.}>" + 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 |