avoid some compiler crashes in debug mode

This commit is contained in:
Andreas Rumpf 2017-01-23 10:49:56 +01:00
commit 93068f1ba6
2 changed files with 8 additions and 3 deletions

View file

@ -314,7 +314,9 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
if bodyIsNew and newbody.typeInst == nil:
#doassert newbody.typeInst == nil
newbody.typeInst = result
if tfRefsAnonObj in newbody.flags:
if tfRefsAnonObj in newbody.flags and newbody.kind != tyGenericInst:
# can come here for tyGenericInst too, see tests/metatype/ttypeor.nim
# need to look into this issue later
assert newbody.kind in {tyRef, tyPtr}
assert newbody.lastSon.typeInst == nil
newbody.lastSon.typeInst = result