diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index ce8b59f9cd3e..af4384b99889 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -1131,7 +1131,7 @@ proc semForVars(c: PContext, n: PNode; flags: TExprFlags): PNode = # BUGFIX: don't use `iter` here as that would strip away # the ``tyGenericInst``! See ``tests/compile/tgeneric.nim`` # for an example: - v.typ = iterBase + v.typ = makeIterTupleType(c, iterBase) n[0] = newSymNode(v) if sfGenSym notin v.flags and not isDiscardUnderscore(v): addDecl(c, v) elif v.owner == nil: setOwner(v, getCurrOwner(c)) diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 42efcd239994..77973521dfcb 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -1787,6 +1787,23 @@ proc maybeAliasType(c: PContext; typeExpr, prev: PType): PType = else: result = nil +proc makeIterTupleType(c: PContext; typ: PType): PType = + if typ.kind == tyTuple: + var hasView = false + result = newTypeS(tyTuple, c) + + for i in 0..