aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-01-08 18:16:12 +0100
committerDmitry Jemerov <yole@jetbrains.com>2016-01-08 18:16:12 +0100
commit931a37df263768f0642b8bd41192e7caf0701ff7 (patch)
tree1c04cc43f59cbd9ca003c1ba87ffa3eac9fbc995 /core/src
parent7fb4d948893db3332fcb7610261300cc5b856cff (diff)
downloaddokka-931a37df263768f0642b8bd41192e7caf0701ff7.tar.gz
dokka-931a37df263768f0642b8bd41192e7caf0701ff7.tar.bz2
dokka-931a37df263768f0642b8bd41192e7caf0701ff7.zip
include extension function in the list of extensions for a class if the class is an upper bound of the receiver type parameter
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt6
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt4
2 files changed, 10 insertions, 0 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index 2a69bb13..aaaffd6f 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -546,6 +546,12 @@ class DocumentationBuilder
if ((receiverClass as? ClassDescriptor)?.isCompanionObject ?: false) {
receiverClass = receiverClass.containingDeclaration!!
}
+ else if (receiverClass is TypeParameterDescriptor) {
+ val upperBoundClass = receiverClass.upperBounds.singleOrNull()?.constructor?.declarationDescriptor
+ if (upperBoundClass != null) {
+ receiverClass = upperBoundClass
+ }
+ }
link(receiverClass,
containingDeclaration,
RefKind.Extension)
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index 509b5f39..427889c5 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -238,6 +238,10 @@ public class MarkdownFormatTest {
verifyMarkdownNodeByName("inapplicableExtensionFunctions", "Bar")
}
+ @Test fun receiverParameterTypeBound() {
+ verifyMarkdownNodeByName("receiverParameterTypeBound", "Foo")
+ }
+
private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) {
verifyOutput("testdata/format/$fileName.kt", ".package.md", withKotlinRuntime = withKotlinRuntime) { model, output ->
markdownService.appendNodes(tempLocation, output, model.members)