summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-12-26 01:09:10 +0200
committerZahary Karadjov <zahary@gmail.com>2013-12-26 01:09:10 +0200
commite2594f44bdc99e1c7930dfb66fa258a504ee4d79 (patch)
treed70df083f7d7fdbcf941105d703ac7abdf8f8da4 /compiler
parent86108be24b43d1b4b02a6549e75f64b7625233ac (diff)
downloadNim-e2594f44bdc99e1c7930dfb66fa258a504ee4d79.tar.gz
bugfix: in some contexts, newSeq[T](n) is incorrectly inferred to have a seq[typedesc[T]] type
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index c3d197c3b..6a6888223 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -93,8 +93,10 @@ proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PSym,
     var typeParams = callee.ast[genericParamsPos]
     for i in 1..min(sonsLen(typeParams), sonsLen(binding)-1):
       var formalTypeParam = typeParams.sons[i-1].typ
-      #debug(formalTypeParam)
-      put(c.bindings, formalTypeParam, binding[i].typ)
+      var bound = binding[i].typ
+      if formalTypeParam.kind != tyTypeDesc:
+        bound = bound.skipTypes({tyTypeDesc})
+      put(c.bindings, formalTypeParam, bound)
 
 proc newCandidate*(ctx: PContext, callee: PSym,
                    binding: PNode, calleeScope = -1): TCandidate =