summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2016-11-28 14:16:28 +0100
committerAraq <rumpf_a@web.de>2016-11-28 14:16:28 +0100
commitebaf57ea3bc17d1476e9d4bbd8d107eb6dd631a2 (patch)
tree41088b36e7fba600451dbe034b17be0b6fb41328
parente7cdb1d694ff4af60fcdb2e81c8a1f444296c5eb (diff)
downloadNim-ebaf57ea3bc17d1476e9d4bbd8d107eb6dd631a2.tar.gz
further progress
-rw-r--r--compiler/ast.nim2
-rw-r--r--compiler/ccgtypes.nim1
-rw-r--r--compiler/semtypinst.nim3
-rw-r--r--compiler/sighashes.nim12
4 files changed, 13 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index ffcd08c77..38f481282 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -853,6 +853,8 @@ type
     align*: int16             # the type's alignment requirements
     lockLevel*: TLockLevel    # lock level as required for deadlock checking
     loc*: TLoc
+    typeInst*: PType          # for generic instantiations the tyGenericInst that led to this
+                              # type.
 
   TPair* = object
     key*, val*: RootRef
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index 822d69150..9b12d38a2 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -758,7 +758,6 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
   excl(check, t.id)
 
 proc getTypeDesc(m: BModule, typ: PType): Rope =
-  echo "getTypeDesc called!"
   var check = initIntSet()
   result = getTypeDescAux(m, typ, check)
 
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index a2626ffe4..29e75e188 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -310,6 +310,9 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
     # generics *when the type is constructed*:
     newbody.deepCopy = cl.c.instTypeBoundOp(cl.c, dc, result, cl.info,
                                             attachedDeepCopy, 1)
+  newbody.typeInst = result
+  if newbody.kind == tyRef:
+    newbody.lastSon.typeInst = result
   let asgn = newbody.assignment
   if asgn != nil and sfFromGeneric notin asgn.flags:
     # '=' needs to be instantiated for generics when the type is constructed:
diff --git a/compiler/sighashes.nim b/compiler/sighashes.nim
index a2d67ea24..6918b28a2 100644
--- a/compiler/sighashes.nim
+++ b/compiler/sighashes.nim
@@ -159,10 +159,14 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
     # Every cyclic type in Nim need to be constructed via some 't.sym', so this
     # is actually safe without an infinite recursion check:
     if t.sym != nil:
-      if "Future:" in t.sym.name.s:
-        writeStackTrace()
-        echo "yes ", t.sym.name.s
-        #quit 1
+      #if "Future:" in t.sym.name.s and t.typeInst == nil:
+      #  writeStackTrace()
+      #  echo "yes ", t.sym.name.s
+      #  #quit 1
+      if t.typeInst != nil:
+        assert t.typeInst.kind == tyGenericInst
+        for i in countup(1, sonsLen(t.typeInst) - 2):
+          c.hashType t.typeInst.sons[i], flags
       c.hashSym(t.sym)
     else:
       lowlevel(t.id)