package org.jetbrains.dokka.model data class AncestryNode( val typeConstructor: TypeConstructor, val superclass: AncestryNode?, val interfaces: List, ) { fun allImplementedInterfaces(): List { fun traverseInterfaces(ancestry: AncestryNode): List = ancestry.interfaces.flatMap { listOf(it.typeConstructor) + traverseInterfaces(it) } + (ancestry.superclass?.let(::traverseInterfaces) ?: emptyList()) return traverseInterfaces(this).distinct() } }