summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorConstantine Molchanov <moigagoo@live.com>2023-02-27 02:56:43 +0300
committerGitHub <noreply@github.com>2023-02-27 00:56:43 +0100
commit4ae598762e7dac1886b481a48ae0875843e5153f (patch)
treeab74d7c4087d57dda3e9f4616ee40fba8c2ec114
parent425225119a383511ac6f84ba5c02a691e6c51aea (diff)
downloadNim-4ae598762e7dac1886b481a48ae0875843e5153f.tar.gz
fixes #21439; Add tyOpenArray to genTypeInfo. (#21440)
* fixes #21439; Add tyOpenArray to genTypeInfo.

* Add test.
-rw-r--r--compiler/jstypes.nim2
-rw-r--r--tests/js/t21439.nim14
2 files changed, 15 insertions, 1 deletions
diff --git a/compiler/jstypes.nim b/compiler/jstypes.nim
index 56d075af7..4b4ca9fe7 100644
--- a/compiler/jstypes.nim
+++ b/compiler/jstypes.nim
@@ -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))]
diff --git a/tests/js/t21439.nim b/tests/js/t21439.nim
new file mode 100644
index 000000000..972356cd0
--- /dev/null
+++ b/tests/js/t21439.nim
@@ -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)
+