summary refs log tree commit diff stats
path: root/compiler/semexprs.nim
diff options
context:
space:
mode:
authorMatthew Baulch <baulch.matt@gmail.com>2016-07-15 20:36:11 +1000
committerMatthew Baulch <baulch.matt@gmail.com>2016-07-15 20:36:11 +1000
commit915185dd11b6b4cdabf20cd3e9985b8044e2d3e2 (patch)
treebbd0da149ccbea86f0d168b65c59a1ba98c98569 /compiler/semexprs.nim
parent05486957d433c3082c549dc0e8c0dd8ae10805a7 (diff)
downloadNim-915185dd11b6b4cdabf20cd3e9985b8044e2d3e2.tar.gz
Handle tuples with unnamed fields, symbols, and more. Less duplication.
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r--compiler/semexprs.nim7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 3208403d4..96c80c64e 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -198,11 +198,8 @@ proc semConv(c: PContext, n: PNode): PNode =
       # separate proc from fitNode?
       if op.kind == nkSym and op.sym.isGenericRoutine:
         result.sons[1] = fitNode(c, result.typ, result.sons[1])
-      elif op.kind == nkPar and targetType.kind == tyTuple and
-                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:
-          op.sons[i][1].typ = targetType.sons[i]
+      elif op.kind == nkPar and targetType.kind == tyTuple:
+        op = fitNode(c, targetType, op)
     of convNotNeedeed:
       message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString)
     of convNotLegal: