Fix: Correctly (and more efficiently) handle non-tuple conversions.

This commit is contained in:
Matthew Baulch 2016-07-14 21:24:39 +10:00
commit 05486957d4

View file

@ -198,8 +198,9 @@ proc semConv(c: PContext, n: PNode): PNode =
# separate proc from fitNode? # separate proc from fitNode?
if op.kind == nkSym and op.sym.isGenericRoutine: if op.kind == nkSym and op.sym.isGenericRoutine:
result.sons[1] = fitNode(c, result.typ, result.sons[1]) result.sons[1] = fitNode(c, result.typ, result.sons[1])
elif op.kind == nkPar and targetType.kind == tyTuple: elif op.kind == nkPar and targetType.kind == tyTuple and
# Set type of each field in case any have type tyEmpty (eg. `@[]`) op.sons.len > 0 and op.sons[0].kind == nkExprColonExpr:
# Tuple conversion: set field types in case any are tyEmpty (eg. `@[]`)
for i in 0..<op.sons.len: for i in 0..<op.sons.len:
op.sons[i][1].typ = targetType.sons[i] op.sons[i][1].typ = targetType.sons[i]
of convNotNeedeed: of convNotNeedeed: