bugfix: cycle analysis needs to take inheritance into account

This commit is contained in:
Araq 2012-06-24 17:36:22 +02:00
commit 776920dc71

View file

@ -330,8 +330,10 @@ proc canFormAcycleAux(marker: var TIntSet, typ: PType, startId: int): bool =
if t.n != nil: result = canFormAcycleNode(marker, t.n, startId)
else:
result = t.id == startId
else:
nil
if t.kind == tyObject and tfFinal notin t.flags:
# damn inheritance may introduce cycles:
result = true
else: nil
proc canFormAcycle(typ: PType): bool =
# XXX as I expect cycles introduced by closures are very rare, we pretend