summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r--compiler/sempass2.nim9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 8193a3537..86e569d7a 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -514,8 +514,17 @@ proc propagateEffects(tracked: PEffects, n: PNode, s: PSym) =
     markSideEffect(tracked, s)
   mergeLockLevels(tracked, n, s.getLockLevel)
 
+proc procVarcheck(n: PNode) =
+  if n.kind in nkSymChoices:
+    for x in n: procVarCheck(x)
+  elif n.kind == nkSym and n.sym.magic != mNone:
+    localError(n.info, errXCannotBePassedToProcVar, n.sym.name.s)
+
 proc notNilCheck(tracked: PEffects, n: PNode, paramType: PType) =
   let n = n.skipConv
+  procVarcheck skipConvAndClosure(n)
+  #elif n.kind in nkSymChoices:
+  #  echo "came here"
   if paramType != nil and tfNotNil in paramType.flags and
       n.typ != nil and tfNotNil notin n.typ.flags:
     if n.kind == nkAddr: