summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYuriy Glukhov <yglukhov@users.noreply.github.com>2017-06-26 22:31:56 +0300
committerAndreas Rumpf <rumpf_a@web.de>2017-06-26 21:31:56 +0200
commitbaf685461bad85931030a56964fceec9edc1ec59 (patch)
treea12800a63297d1ef9d4095d99d1491ffa88579cb
parent326e8fdc2ffb1644ff7942ef15e647663e8d5e18 (diff)
downloadNim-baf685461bad85931030a56964fceec9edc1ec59.tar.gz
Fixes #5946 (#6017)
-rw-r--r--compiler/cgmeth.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/cgmeth.nim b/compiler/cgmeth.nim
index 1165ec932..6f7d9f489 100644
--- a/compiler/cgmeth.nim
+++ b/compiler/cgmeth.nim
@@ -257,13 +257,14 @@ proc genDispatcher(methods: TSymSeq, relevantCols: IntSet): PSym =
           cond = a
         else:
           cond = isn
-    var call = newNodeI(nkCall, base.info)
+    let retTyp = base.typ.sons[0]
+    let call = newNodeIT(nkCall, base.info, retTyp)
     addSon(call, newSymNode(curr))
     for col in countup(1, paramLen - 1):
       addSon(call, genConv(newSymNode(base.typ.n.sons[col].sym),
                            curr.typ.sons[col], false))
     var ret: PNode
-    if base.typ.sons[0] != nil:
+    if retTyp != nil:
       var a = newNodeI(nkFastAsgn, base.info)
       addSon(a, newSymNode(base.ast.sons[resultPos].sym))
       addSon(a, call)