summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-01-07 20:03:41 +0100
committerAraq <rumpf_a@web.de>2012-01-07 20:03:41 +0100
commit7405278138f4e76d5e6278b3ed25f953ba9260e1 (patch)
tree7c634a657e72eb4a2aaf1e1a472531daecd6ac99 /compiler/semstmts.nim
parent0e22a51095d189080ef8af445376fb7ccc061c85 (diff)
downloadNim-7405278138f4e76d5e6278b3ed25f953ba9260e1.tar.gz
bugfix: type alias to generic; generic type not stripped away from for loop variable
Diffstat (limited to 'compiler/semstmts.nim')
-rwxr-xr-xcompiler/semstmts.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index fdb2bfe36..52a3853f2 100755
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -417,7 +417,10 @@ proc semFor(c: PContext, n: PNode): PNode =
     if iter.kind != tyTuple or length == 3: 
       if length != 3: GlobalError(n.info, errWrongNumberOfVariables)
       var v = newSymS(skForVar, n.sons[0], c)
-      v.typ = iter
+      # BUGFIX: don't use `iter` here as that would strip away
+      # the ``tyGenericInst``! See ``tests/compile/tgeneric.nim``
+      # for an example:
+      v.typ = n.sons[length-2].typ
       n.sons[0] = newSymNode(v)
       addDecl(c, v)
     else: