fixes #15360 [backport:1.2] (#15378)

This commit is contained in:
Andreas Rumpf
2020-09-21 12:35:23 +02:00
committed by GitHub
parent 0a1e4cad7f
commit c2434d939e
2 changed files with 8 additions and 1 deletions

View File

@@ -718,7 +718,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode =
result = n
let iterBase = n[^2].typ
var iter = skipTypes(iterBase, {tyGenericInst, tyAlias, tySink, tyOwned})
var iterAfterVarLent = iter.skipTypes({tyLent, tyVar})
var iterAfterVarLent = iter.skipTypes({tyGenericInst, tyAlias, tyLent, tyVar})
# n.len == 3 means that there is one for loop variable
# and thus no tuple unpacking:
if iterAfterVarLent.kind != tyTuple or n.len == 3:

View File

@@ -55,3 +55,10 @@ const
for i in 0..len(stringArray)-1:
echo(stringArray[i])
# bug #15360
type Rule[T] = (int, T)
var t: seq[Rule[int]]
for (c, t) in t:
discard