summary refs log tree commit diff stats
path: root/compiler/sigmatch.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-04 00:57:48 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-04 01:37:41 +0200
commit7ac0b20339eb741fe8c242278cb9eca2534c735c (patch)
tree84c47009b1a3d2ef5cd9712772bb6d5a7e5279e6 /compiler/sigmatch.nim
parent6d98c717deb16d265fb1d26528182eb16b07f784 (diff)
downloadNim-7ac0b20339eb741fe8c242278cb9eca2534c735c.tar.gz
fixes #4545
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r--compiler/sigmatch.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 95f5f0b07..19ef8a117 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1310,6 +1310,13 @@ proc localConvMatch(c: PContext, m: var TCandidate, f, a: PType,
     if r == isGeneric:
       result.typ = getInstantiatedType(c, arg, m, base(f))
     m.baseTypeMatch = true
+    # bug #4545: allow the call to go through a 'var T':
+    let vt = result.sons[0].typ.sons[1]
+    if vt.kind == tyVar:
+      let x = result.sons[1]
+      let va = newNodeIT(nkHiddenAddr, x.info, vt)
+      va.add x
+      result.sons[1] = va
 
 proc incMatches(m: var TCandidate; r: TTypeRelation; convMatch = 1) =
   case r