even more strict isNil handling for strings/seqs in order to detect bugs

This commit is contained in:
Araq 2018-08-22 12:35:46 +02:00
commit 64517445ea
36 changed files with 193 additions and 245 deletions

View file

@ -759,9 +759,10 @@ proc initSameTypeClosure: TSameTypeClosure =
discard
proc containsOrIncl(c: var TSameTypeClosure, a, b: PType): bool =
result = not isNil(c.s) and c.s.contains((a.id, b.id))
result = c.s.len > 0 and c.s.contains((a.id, b.id))
if not result:
if isNil(c.s): c.s = @[]
when not defined(nimNoNilSeqs):
if isNil(c.s): c.s = @[]
c.s.add((a.id, b.id))
proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool