summary refs log tree commit diff stats
path: root/compiler/sem.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/sem.nim')
-rw-r--r--compiler/sem.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 88249fedb..0e4b65d9f 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -58,10 +58,13 @@ proc fitNode(c: PContext, formal: PType, arg: PNode): PNode =
     result = copyNode(arg)
     result.typ = formal
 
+var CommonTypeBegin = PType(kind: tyExpr)
+
 proc commonType*(x, y: PType): PType =
   # new type relation that is used for array constructors,
   # if expressions, etc.:
-  if x == nil: return y
+  if x == nil: return x
+  if y == nil: return y
   var a = skipTypes(x, {tyGenericInst})
   var b = skipTypes(y, {tyGenericInst})
   result = x