diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-21 19:46:20 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-21 19:46:20 +0300 |
commit | 454b4a4c8490a04fcfe17309596c6316cd321113 (patch) | |
tree | 276b1c554b07208d9e024aff1d233044b3378046 | |
parent | 46af59cc658e4f56b6d2909ab4dc93f43af77dc2 (diff) | |
download | dokka-454b4a4c8490a04fcfe17309596c6316cd321113.tar.gz dokka-454b4a4c8490a04fcfe17309596c6316cd321113.tar.bz2 dokka-454b4a4c8490a04fcfe17309596c6316cd321113.zip |
Fix suppressing of companion when it implements some interface
-rw-r--r-- | core/src/main/kotlin/Kotlin/DocumentationBuilder.kt | 3 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/companionImplements.kt | 9 | ||||
-rw-r--r-- | core/testdata/format/companionImplements.md | 16 |
4 files changed, 31 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 24840a9d..0f6f217e 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -575,7 +575,8 @@ class DocumentationBuilder ClassMember(it, inheritedLinkKind = RefKind.InheritedCompanionObjectMember) } - if (companionObjectDescriptor.getAllSuperclassesWithoutAny().isNotEmpty()) { + if (companionObjectDescriptor.getAllSuperclassesWithoutAny().isNotEmpty() + || companionObjectDescriptor.getSuperInterfaces().isNotEmpty()) { result += ClassMember(companionObjectDescriptor) } } diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index f572922c..d2ab5b5c 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -396,6 +396,10 @@ class MarkdownFormatTest { verifyMarkdownNodeByName("notPublishedTypeAliasAutoExpansion", "foo", includeNonPublic = false) } + @Test fun companionImplements() { + verifyMarkdownNodeByName("companionImplements", "Foo") + } + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions("", "html", generateIndexPages = false, noStdlibLink = true) diff --git a/core/testdata/format/companionImplements.kt b/core/testdata/format/companionImplements.kt new file mode 100644 index 00000000..154ef9b1 --- /dev/null +++ b/core/testdata/format/companionImplements.kt @@ -0,0 +1,9 @@ + +interface Bar + +/** + * Correct ref [Foo.Companion] + */ +class Foo { + companion object : Bar +}
\ No newline at end of file diff --git a/core/testdata/format/companionImplements.md b/core/testdata/format/companionImplements.md new file mode 100644 index 00000000..8a93ed6b --- /dev/null +++ b/core/testdata/format/companionImplements.md @@ -0,0 +1,16 @@ +[test](test/index) / [Foo](test/-foo/index) + +# Foo + +`class Foo` + +Correct ref [Foo.Companion](test/-foo/-companion) + +### Types + +| [Companion](test/-foo/-companion) | `companion object Companion : `[`Bar`](test/-bar) | + +### Constructors + +| [<init>](test/-foo/-init-) | `Foo()`<br>Correct ref [Foo.Companion](test/-foo/-companion) | + |