summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-06-08 20:08:49 +0800
committerGitHub <noreply@github.com>2023-06-08 14:08:49 +0200
commita8d0dda8333f78dfa427e0808ff84280363355d4 (patch)
tree7df0afd15fcae5d378f0b7702cf53f642a07c223 /tests
parent750a33cbf160650f7143a8c26ed1588f620762b2 (diff)
downloadNim-a8d0dda8333f78dfa427e0808ff84280363355d4.tar.gz
allow addressing elements of openArray[char] in VM (#22045)
allow addressing elements of openArray[char]
Diffstat (limited to 'tests')
-rw-r--r--tests/vm/tvmmisc.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/vm/tvmmisc.nim b/tests/vm/tvmmisc.nim
index 9e32c9249..5ddb54411 100644
--- a/tests/vm/tvmmisc.nim
+++ b/tests/vm/tvmmisc.nim
@@ -698,3 +698,17 @@ block: # bug #21708
   static:
     let s = X[0]
     doAssert s[0] == "foo"
+
+block:
+  proc swap[T](x: var T): T =
+    result = x
+    x = default(T)
+
+  proc merge[T](a, b: var openArray[T]) =
+    a[0] = swap b[0]
+
+  static:
+    var x = "abc"
+    var y = "356"
+    merge(x, y)
+    doAssert x == "3bc"