This commit is contained in:
Andreas Rumpf 2018-04-28 09:26:15 +02:00
commit ee7515e376

View file

@ -500,12 +500,11 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
localError(a.info, errXExpected, "tuple") localError(a.info, errXExpected, "tuple")
elif length-2 != sonsLen(tup): elif length-2 != sonsLen(tup):
localError(a.info, errWrongNumberOfVariables) localError(a.info, errWrongNumberOfVariables)
else: b = newNodeI(nkVarTuple, a.info)
b = newNodeI(nkVarTuple, a.info) newSons(b, length)
newSons(b, length) b.sons[length-2] = a.sons[length-2] # keep type desc for doc generator
b.sons[length-2] = a.sons[length-2] # keep type desc for doc generator b.sons[length-1] = def
b.sons[length-1] = def addToVarSection(c, result, n, b)
addToVarSection(c, result, n, b)
elif tup.kind == tyTuple and def.kind in {nkPar, nkTupleConstr} and elif tup.kind == tyTuple and def.kind in {nkPar, nkTupleConstr} and
a.kind == nkIdentDefs and a.len > 3: a.kind == nkIdentDefs and a.len > 3:
message(a.info, warnEachIdentIsTuple) message(a.info, warnEachIdentIsTuple)
@ -547,7 +546,9 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
addToVarSection(c, result, n, b) addToVarSection(c, result, n, b)
else: else:
if def.kind in {nkPar, nkTupleConstr}: v.ast = def[j] if def.kind in {nkPar, nkTupleConstr}: v.ast = def[j]
setVarType(v, tup.sons[j]) # bug #7663, for 'nim check' this can be a non-tuple:
if tup.kind == tyTuple: setVarType(v, tup.sons[j])
else: v.typ = tup
b.sons[j] = newSymNode(v) b.sons[j] = newSymNode(v)
checkNilable(v) checkNilable(v)
if sfCompileTime in v.flags: hasCompileTime = true if sfCompileTime in v.flags: hasCompileTime = true