summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-05-15 08:18:20 +0200
committerGitHub <noreply@github.com>2019-05-15 08:18:20 +0200
commit95f8ed03821be6725b22e52de47c3efc413af908 (patch)
treefcb1d2ee5e3460656dcfa1fa2bdfc31476178672 /compiler
parent9ecb24e443453066e2f9361784daf51f3e5c7f9c (diff)
downloadNim-95f8ed03821be6725b22e52de47c3efc413af908.tar.gz
fixes #6732 (#11255)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sigmatch.nim13
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index d2ac311c8..978ee37fa 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -124,6 +124,12 @@ proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PType) =
   initIdTable(c.bindings)
 
 proc put(c: var TCandidate, key, val: PType) {.inline.} =
+  when false:
+    let old = PType(idTableGet(c.bindings, key))
+    if old != nil:
+      echo "Putting ", typeToString(key), " ", typeToString(val), " and old is ", typeToString(old)
+      if typeToString(old) == "seq[string]":
+        writeStackTrace()
   idTablePut(c.bindings, key, val.skipIntLit)
 
 proc initCandidate*(ctx: PContext, c: var TCandidate, callee: PSym,
@@ -1520,7 +1526,12 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
           elif x.kind in {tyGenericInvocation, tyGenericParam}:
             internalError(c.c.graph.config, "wrong instantiated type!")
           else:
-            put(c, f.sons[i], x)
+            let key = f.sons[i]
+            let old = PType(idTableGet(c.bindings, key))
+            if old == nil:
+              put(c, key, x)
+            elif typeRel(c, old, x, flags + {trDontBind}) == isNone:
+              return isNone
 
       if result == isNone:
         # Here object inheriting from generic/specialized generic object