mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 06:45:27 +00:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user