make tsigbreak.nim compile

This commit is contained in:
Andreas Rumpf 2016-12-12 14:08:01 +01:00
commit e169eaac5b
5 changed files with 42 additions and 7 deletions

View file

@ -293,6 +293,7 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
let bbody = lastSon body
var newbody = replaceTypeVarsT(cl, bbody)
let bodyIsNew = newbody != bbody
cl.skipTypedesc = oldSkipTypedesc
newbody.flags = newbody.flags + (t.flags + body.flags - tfInstClearedFlags)
result.flags = result.flags + newbody.flags - tfInstClearedFlags
@ -310,9 +311,13 @@ 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
if bodyIsNew and newbody.typeInst == nil:
#doassert newbody.typeInst == nil
newbody.typeInst = result
if tfRefsAnonObj in newbody.flags:
assert newbody.kind in {tyRef, tyPtr}
assert newbody.lastSon.typeInst == nil
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: