allow addressing elements of openArray[char] in VM (#22045)

allow addressing elements of openArray[char]

(cherry picked from commit a8d0dda833)
This commit is contained in:
ringabout
2023-06-08 20:08:49 +08:00
committed by narimiran
parent 8f102f9e62
commit e8ec3efd3d
2 changed files with 16 additions and 0 deletions

View File

@@ -657,3 +657,17 @@ proc macroGlobal =
static: macroGlobal()
macroGlobal()
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"