diff --git a/compiler/types.nim b/compiler/types.nim index 7b59fbf200..7a9b6bb85f 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -969,6 +969,7 @@ proc inheritanceDiff*(a, b: PType): int = # | returns: -x iff `a` is the x'th direct superclass of `b` # | returns: +x iff `a` is the x'th direct subclass of `b` # | returns: `maxint` iff `a` and `b` are not compatible at all + if a == b or a.kind == tyError or b.kind == tyError: return 0 assert a.kind == tyObject assert b.kind == tyObject var x = a