bugfix: type alias to generic; generic type not stripped away from for loop variable

This commit is contained in:
Araq 2012-01-07 20:03:41 +01:00
commit 7405278138
8 changed files with 118 additions and 69 deletions

View file

@ -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: