further progress

This commit is contained in:
Araq 2016-11-28 14:16:28 +01:00
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 align*: int16 # the type's alignment requirements
lockLevel*: TLockLevel # lock level as required for deadlock checking lockLevel*: TLockLevel # lock level as required for deadlock checking
loc*: TLoc loc*: TLoc
typeInst*: PType # for generic instantiations the tyGenericInst that led to this
# type.
TPair* = object TPair* = object
key*, val*: RootRef key*, val*: RootRef

View file

@ -758,7 +758,6 @@ proc getTypeDescAux(m: BModule, origTyp: PType, check: var IntSet): Rope =
excl(check, t.id) excl(check, t.id)
proc getTypeDesc(m: BModule, typ: PType): Rope = proc getTypeDesc(m: BModule, typ: PType): Rope =
echo "getTypeDesc called!"
var check = initIntSet() var check = initIntSet()
result = getTypeDescAux(m, typ, check) 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*: # generics *when the type is constructed*:
newbody.deepCopy = cl.c.instTypeBoundOp(cl.c, dc, result, cl.info, newbody.deepCopy = cl.c.instTypeBoundOp(cl.c, dc, result, cl.info,
attachedDeepCopy, 1) attachedDeepCopy, 1)
newbody.typeInst = result
if newbody.kind == tyRef:
newbody.lastSon.typeInst = result
let asgn = newbody.assignment let asgn = newbody.assignment
if asgn != nil and sfFromGeneric notin asgn.flags: if asgn != nil and sfFromGeneric notin asgn.flags:
# '=' needs to be instantiated for generics when the type is constructed: # '=' 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 # Every cyclic type in Nim need to be constructed via some 't.sym', so this
# is actually safe without an infinite recursion check: # is actually safe without an infinite recursion check:
if t.sym != nil: if t.sym != nil:
if "Future:" in t.sym.name.s: #if "Future:" in t.sym.name.s and t.typeInst == nil:
writeStackTrace() # writeStackTrace()
echo "yes ", t.sym.name.s # echo "yes ", t.sym.name.s
#quit 1 # #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) c.hashSym(t.sym)
else: else:
lowlevel(t.id) lowlevel(t.id)