summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-03-28 20:57:34 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-03-28 20:57:34 +0200
commitb58fbd1b48bd0e0eaf334422d84ad7cd9238f243 (patch)
treef1c9ad450b6b1d6c935b43986c46cdd4381ccda2
parent172a9c8e97694846c3348983a9b2b7c2931c939d (diff)
downloadNim-b58fbd1b48bd0e0eaf334422d84ad7cd9238f243.tar.gz
fixes #5618
-rw-r--r--compiler/transf.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 771dc58f4..41959b018 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -566,7 +566,10 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
   pushTransCon(c, newC)
   for i in countup(1, sonsLen(call) - 1):
     var arg = transform(c, call.sons[i]).PNode
-    var formal = skipTypes(iter.typ, abstractInst).n.sons[i].sym
+    let ff = skipTypes(iter.typ, abstractInst)
+    # can happen for 'nim check':
+    if i >= ff.n.len: return result
+    var formal = ff.n.sons[i].sym
     case putArgInto(arg, formal.typ)
     of paDirectMapping:
       idNodeTablePut(newC.mapping, formal, arg)