Fix const tuple unpacking not working for variables > 2 (#10099)

This commit is contained in:
Neelesh Chandola 2018-12-27 05:20:33 +05:30 • committed by Andreas Rumpf
commit 65a52ecebb

View file

@ -580,7 +580,7 @@ proc semConst(c: PContext, n: PNode): PNode =
if a.kind == nkVarTuple:
if typ.kind != tyTuple:
localError(c.config, a.info, errXExpected, "tuple")
elif int(length/2) != sonsLen(typ):
elif length-2 != sonsLen(typ):
localError(c.config, a.info, errWrongNumberOfVariables)
b = newNodeI(nkVarTuple, a.info)
newSons(b, length)