fixes #23556; typeinfo.extendSeq generates random values in ORC (#23557)

fixes #23556

It should somehow handle default fields in the future
This commit is contained in:
ringabout
2024-05-03 22:29:56 +08:00
committed by GitHub
parent d772186b2d
commit 36bf3fa47b
3 changed files with 28 additions and 2 deletions

View File

@@ -74,3 +74,20 @@ block:
doAssert getEnumOrdinal(y, "Hello") == 0
doAssert getEnumOrdinal(y, "hello") == 1
block: # bug #23556
proc test =
var
t: seq[int]
aseq = toAny(t)
invokeNewSeq(aseq, 0)
# Got random value only when loop 8 times.
for i in 1 .. 8:
extendSeq(aseq)
doAssert t == @[0, 0, 0, 0, 0, 0, 0, 0]
for i in 1 .. 7:
test()