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
commit 4ae598762e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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" % "var $1 = {size: 0,kind: $2,base: null,node: null,finalizer: null};$n" %
[result, rope(ord(t.kind))] [result, rope(ord(t.kind))]
prepend(p.g.typeInfo, s) 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 s =
"var $1 = {size: 0, kind: $2, base: null, node: null, finalizer: null};$n" % "var $1 = {size: 0, kind: $2, base: null, node: null, finalizer: null};$n" %
[result, rope(ord(t.kind))] [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)