fixes #16671; openarray conversion for object construction (#23618)

fixes #16671

related to https://github.com/nim-lang/Nim/pull/18911
This commit is contained in:
ringabout
2024-05-17 05:27:08 +08:00
committed by GitHub
parent 0ba932132e
commit b87732b5f1
2 changed files with 29 additions and 3 deletions

View File

@@ -35,3 +35,25 @@ block: # bug #15778
doAssert @(reader.read(3)) == @['l', 'l', 'o']
doAssert count == 2
block: # bug #16671
block:
type X = ref object of RootObj
type Y = ref object of X
field: openArray[int]
var s: seq[X]
proc f() =
s.add(Y(field: [1]))
f()
block:
type X = ref object of RootObj
type Y = ref object of X
field: openArray[int]
var s: seq[X]
proc f() =
s.add(Y(field: toOpenArray([1, 2, 3], 0, 1)))
f()