fixes #21439; Add tyOpenArray to genTypeInfo. (#21440)

* fixes #21439; Add tyOpenArray to genTypeInfo.

* Add test.
This commit is contained in:
Constantine Molchanov
2023-02-27 02:56:43 +03:00
committed by GitHub
parent 425225119a
commit 4ae598762e
2 changed files with 15 additions and 1 deletions

View File

@@ -133,7 +133,7 @@ proc genTypeInfo(p: PProc, typ: PType): Rope =
"var $1 = {size: 0,kind: $2,base: null,node: null,finalizer: null};$n" %
[result, rope(ord(t.kind))]
prepend(p.g.typeInfo, s)
of tyVar, tyLent, tyRef, tyPtr, tySequence, tyRange, tySet:
of tyVar, tyLent, tyRef, tyPtr, tySequence, tyRange, tySet, tyOpenArray:
var s =
"var $1 = {size: 0, kind: $2, base: null, node: null, finalizer: null};$n" %
[result, rope(ord(t.kind))]

14
tests/js/t21439.nim Normal file
View File

@@ -0,0 +1,14 @@
discard """
action: "compile"
"""
proc test(a: openArray[string]): proc =
result = proc =
for i in a:
discard i
const a = ["t1", "t2"]
discard test(a)