summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorMatthew Baulch <baulch.matt@gmail.com>2016-07-14 21:24:39 +1000
committerMatthew Baulch <baulch.matt@gmail.com>2016-07-14 21:24:39 +1000
commit05486957d433c3082c549dc0e8c0dd8ae10805a7 (patch)
treedf61f6f9f35c58cd4d4627ddc7b8db19f120819a /compiler
parentde41649b0e044729583e8c5061593bc7ebff594d (diff)
downloadNim-05486957d433c3082c549dc0e8c0dd8ae10805a7.tar.gz
Fix: Correctly (and more efficiently) handle non-tuple conversions.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semexprs.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 5a27d8621..3208403d4 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -198,8 +198,9 @@ 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:
-        # Set type of each field in case any have type tyEmpty (eg. `@[]`)
+      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]
     of convNotNeedeed: