fix @ for openarray on nimscript [backport:2.2] (#25641)

Even on nimscript, the `else` branch of the `when nimvm` below compiles
and gives an "undeclared identifier: copyMem" error. Regression since
#25064.

(cherry picked from commit 6f85d348f4)
This commit is contained in:
metagn
2026-03-24 10:27:28 +03:00
committed by narimiran
parent 48bb08ea92
commit 4d15d918ef
2 changed files with 5 additions and 1 deletions

View File

@@ -1471,7 +1471,7 @@ when defined(nimHasTopDownInference):
## This is not as efficient as turning a fixed length array into a sequence
## as it always copies every element of `a`.
let sz = a.len
when supportsCopyMem(T) and not defined(js):
when supportsCopyMem(T) and not defined(js) and not defined(nimscript):
result = newSeqUninit[T](sz)
when nimvm:
for i in 0..sz-1: result[i] = a[i]

View File

@@ -143,3 +143,7 @@ proc discardableCall(cmd: string): int {.discardable.} =
result = 123
discardableCall "echo hi"
block:
let a = "abc"
doAssert @a == @['a', 'b', 'c']