mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-01 03:24:41 +00:00
fixes #25007 ```nim proc setLengthSeqUninit(s: PGenericSeq, typ: PNimType, newLen: int, isTrivial: bool): PGenericSeq {. compilerRtl.} = ``` In this added function, only the line `zeroMem(dataPointer(result, elemAlign, elemSize, newLen), (result.len-%newLen) *% elemSize)` is removed from `proc setLengthSeqV2` when enlarging a sequence. JS and VM versions simply use `setLen`.
This commit is contained in:
@@ -236,5 +236,12 @@ proc bar2() =
|
||||
doAssert cstring(nil) <= cstring(nil)
|
||||
doAssert cstring("") <= cstring("")
|
||||
|
||||
var x = @[10, 20]
|
||||
x.setLenUninit(5)
|
||||
x[4] = 50
|
||||
doAssert x[4] == 50
|
||||
x.setLenUninit(1)
|
||||
doAssert x == @[10]
|
||||
|
||||
static: bar2()
|
||||
bar2()
|
||||
|
||||
Reference in New Issue
Block a user