summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgcalls.nim1
-rw-r--r--compiler/sem.nim6
-rw-r--r--compiler/transf.nim5
3 files changed, 10 insertions, 2 deletions
diff --git a/compiler/ccgcalls.nim b/compiler/ccgcalls.nim
index 828e666a8..f6cc6da74 100644
--- a/compiler/ccgcalls.nim
+++ b/compiler/ccgcalls.nim
@@ -369,6 +369,7 @@ proc genParams(p: BProc, ri: PNode, typ: PType): Rope =
     if ri[i].skipTrivialIndirections.kind == nkSym:
       needTmp[i - 1] = potentialAlias(ri[i], potentialWrites)
     else:
+      #if not ri[i].typ.isCompileTimeOnly:
       var potentialReads: seq[PNode]
       getPotentialReads(ri[i], potentialReads)
       for n in potentialReads:
diff --git a/compiler/sem.nim b/compiler/sem.nim
index 24709cf21..ad0ba1f7c 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -174,6 +174,12 @@ proc commonType*(c: PContext; x, y: PType): PType =
         result = b #.skipIntLit
       elif a.kind in IntegralTypes and a.n != nil:
         result = a #.skipIntLit
+  elif a.kind == tyProc and b.kind == tyProc:
+    if a.callConv == ccClosure and b.callConv != ccClosure:
+      result = x
+    elif compatibleEffects(a, b) != efCompat or
+        (b.flags * {tfNoSideEffect, tfGcSafe}) < (a.flags * {tfNoSideEffect, tfGcSafe}):
+      result = y
   else:
     var k = tyNone
     if a.kind in {tyRef, tyPtr}:
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 5846e6e3b..89fa89701 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -1023,8 +1023,9 @@ proc transform(c: PTransf, n: PNode): PNode =
     result[0] = transform(c, n[0])
     # Skip the second son since it only contains an unsemanticized copy of the
     # variable type used by docgen
-    result[1] = n[1]
-    result[2] = transform(c, n[2])
+    let last = n.len-1
+    for i in 1..<last: result[i] = n[i]
+    result[last] = transform(c, n[last])
     # XXX comment handling really sucks:
     if importantComments(c.graph.config):
       result.comment = n.comment