further progress

This commit is contained in:
Araq
2016-11-28 14:16:28 +01:00
parent e7cdb1d694
commit ebaf57ea3b
4 changed files with 13 additions and 5 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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:

View File

@@ -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)