diff options
Diffstat (limited to 'plugins/base/src/test/kotlin/model/InheritorsTest.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/model/InheritorsTest.kt | 59 |
1 files changed, 50 insertions, 9 deletions
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt index 151783a9..49d02e4c 100644 --- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt +++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt @@ -106,15 +106,6 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", } } } - interface A<E> { - val a: E - } - - open class C - class B<E>() : C(), A<E> { - override val a: E - get() = TODO("Not yet implemented") - } @Test fun `should inherit docs`() { @@ -370,4 +361,54 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", } } } + + @Test + fun `should inherit docs in case of diamond inheritance`() { + inlineModelTest( + """ + public interface Collection2<out E> { + /** + * Returns `true` if the collection is empty (contains no elements), `false` otherwise. + */ + public fun isEmpty(): Boolean + + /** + * Checks if the specified element is contained in this collection. + */ + public operator fun contains(element: @UnsafeVariance E): Boolean + } + + public interface MutableCollection2<E> : Collection2<E>, MutableIterable2<E> + + + public interface List2<out E> : Collection2<E> { + override fun isEmpty(): Boolean + override fun contains(element: @UnsafeVariance E): Boolean + } + + public interface MutableList2<E> : List2<E>, MutableCollection2<E> + + public class AbstractMutableList2<E> : MutableList2<E> { + protected constructor() + + // From List + + override fun isEmpty(): Boolean = size == 0 + public override fun contains(element: E): Boolean = indexOf(element) != -1 + } + public class ArrayDeque2<E> : AbstractMutableList2<E> { + override fun isEmpty(): Boolean = size == 0 + public override fun contains(element: E): Boolean = indexOf(element) != -1 + + } + """.trimMargin() + ) { + with((this / "inheritors" / "ArrayDeque2" / "isEmpty").cast<DFunction>()) { + documentation.size equals 1 + } + with((this / "inheritors" / "ArrayDeque2" / "contains").cast<DFunction>()) { + documentation.size equals 1 + } + } + } } |