summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2014-12-31 12:31:02 +0200
committerZahary Karadjov <zahary@gmail.com>2015-01-02 23:58:24 +0200
commitad65a2039177b706d6dc5d3c0c7657da9e202a23 (patch)
tree6071d29e158e1a053aeccdb597c7f1f02d3dbb75
parent5023a9043858941d311c253fd1b62017080367be (diff)
downloadNim-ad65a2039177b706d6dc5d3c0c7657da9e202a23.tar.gz
fix #419
-rw-r--r--compiler/sigmatch.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index b58818a29..6d6e26b2d 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -109,9 +109,12 @@ proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PSym,
     for i in 1..min(sonsLen(typeParams), sonsLen(binding)-1):
       var formalTypeParam = typeParams.sons[i-1].typ
       var bound = binding[i].typ
-      if bound != nil and formalTypeParam.kind != tyTypeDesc:
+      internalAssert bound != nil
+      if formalTypeParam.kind == tyTypeDesc:
+        if bound.kind != tyTypeDesc:
+          bound = makeTypeDesc(ctx, bound)
+      else:
         bound = bound.skipTypes({tyTypeDesc})
-      assert bound != nil
       put(c.bindings, formalTypeParam, bound)
 
 proc newCandidate*(ctx: PContext, callee: PSym,