summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2020-04-20 14:57:36 +0100
committerGitHub <noreply@github.com>2020-04-20 15:57:36 +0200
commit65c5367dc1c29d01f00dbc2bcfb574af5f3334fa (patch)
treee8e919192a2c00ea5cdfd2afdb750ec63bba6959 /compiler
parentba0af0f827d97532516e4c2acc1fdbb9cdba7b61 (diff)
downloadNim-65c5367dc1c29d01f00dbc2bcfb574af5f3334fa.tar.gz
Fixes #14014 (#14029)
* add test

* improve test

* progress

* fix #14014

* fix bug

Co-authored-by: cooldome <ariabushenko@bk.ru>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/spawn.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/spawn.nim b/compiler/spawn.nim
index c60dd934c..8b1f89e15 100644
--- a/compiler/spawn.nim
+++ b/compiler/spawn.nim
@@ -201,8 +201,11 @@ proc setupArgsForConcurrency(g: ModuleGraph; n: PNode; objType: PType;
     # we pick n's type here, which hopefully is 'tyArray' and not
     # 'tyOpenArray':
     var argType = n[i].typ.skipTypes(abstractInst)
-    if i < formals.len and formals[i].typ.kind in {tyVar, tyLent}:
-      localError(g.config, n[i].info, "'spawn'ed function cannot have a 'var' parameter")
+    if i < formals.len: 
+      if formals[i].typ.kind in {tyVar, tyLent}:
+        localError(g.config, n[i].info, "'spawn'ed function cannot have a 'var' parameter")
+      if formals[i].typ.kind in {tyTypeDesc, tyStatic}:
+        continue
     #elif containsTyRef(argType):
     #  localError(n[i].info, "'spawn'ed function cannot refer to 'ref'/closure")
 
@@ -226,6 +229,8 @@ proc setupArgsForParallelism(g: ModuleGraph; n: PNode; objType: PType;
   # for correctness: These are called 'threadLocal' here.
   for i in 1..<n.len:
     let n = n[i]
+    if i < formals.len and formals[i].typ.kind in {tyStatic, tyTypeDesc}:
+      continue
     let argType = skipTypes(if i < formals.len: formals[i].typ else: n.typ,
                             abstractInst)
     #if containsTyRef(argType):