aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-01-05 17:43:40 +0100
committerDmitry Jemerov <yole@jetbrains.com>2016-01-05 17:43:40 +0100
commit9b9b689d67a20abb52fcde5ed4655d9a5092b8df (patch)
treef0ac5e76533d4ab911f424adbfb0179e66f47c57 /core
parentefd848a7d5f5f241de4696d34a500d76f51b3cbc (diff)
downloaddokka-9b9b689d67a20abb52fcde5ed4655d9a5092b8df.tar.gz
dokka-9b9b689d67a20abb52fcde5ed4655d9a5092b8df.tar.bz2
dokka-9b9b689d67a20abb52fcde5ed4655d9a5092b8df.zip
always include type parameters in the signature of a type
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt5
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt14
-rw-r--r--core/testdata/format/arrayAverage.kt8
-rw-r--r--core/testdata/format/arrayAverage.md25
4 files changed, 45 insertions, 7 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index e3de493a..f92d15f9 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -633,10 +633,7 @@ fun CallableMemberDescriptor.parameterSignature(): String {
fun KotlinType.signature(): String {
val declarationDescriptor = constructor.declarationDescriptor ?: return "<null>"
val typeName = DescriptorUtils.getFqName(declarationDescriptor).asString()
- if (typeName == "Array" && arguments.size == 1) {
- return "Array<" + arguments.first().type.signature() + ">"
- }
- return typeName
+ return typeName + arguments.joinToString(prefix = "<", postfix = ">") { it.type.signature() }
}
fun DeclarationDescriptor.signatureWithSourceLocation(): String {
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index 5ec2b637..81e0cb6b 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -215,9 +215,11 @@ public class MarkdownFormatTest {
}
@Test fun inheritedExtensions() {
- verifyOutput("testdata/format/inheritedExtensions.kt", ".md") { model, output ->
- markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" })
- }
+ verifyMarkdownNodeByName("inheritedExtensions", "Bar")
+ }
+
+ @Test fun arrayAverage() {
+ verifyMarkdownNodeByName("arrayAverage", "XArray")
}
private fun verifyMarkdownPackage(fileName: String, withKotlinRuntime: Boolean = false) {
@@ -231,4 +233,10 @@ public class MarkdownFormatTest {
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
+
+ private fun verifyMarkdownNodeByName(fileName: String, name: String) {
+ verifyOutput("testdata/format/$fileName.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == name })
+ }
+ }
}
diff --git a/core/testdata/format/arrayAverage.kt b/core/testdata/format/arrayAverage.kt
new file mode 100644
index 00000000..1f9e12db
--- /dev/null
+++ b/core/testdata/format/arrayAverage.kt
@@ -0,0 +1,8 @@
+class XArray<T>
+
+fun XArray<out Byte>.average(): Double = 0.0
+fun XArray<out Double>.average(): Double = 0.0
+fun XArray<out Float>.average(): Double = 0.0
+fun XArray<out Int>.average(): Double = 0.0
+fun XArray<out Long>.average(): Double = 0.0
+fun XArray<out Short>.average(): Double = 0.0
diff --git a/core/testdata/format/arrayAverage.md b/core/testdata/format/arrayAverage.md
new file mode 100644
index 00000000..9ffa3650
--- /dev/null
+++ b/core/testdata/format/arrayAverage.md
@@ -0,0 +1,25 @@
+[test](test/index) / [XArray](test/-x-array/index)
+
+
+# XArray
+
+`class XArray&lt;T&gt;`
+
+
+
+### Constructors
+
+
+| [&lt;init&gt;](test/-x-array/-init-) | `XArray()` |
+
+
+### Extension Functions
+
+
+| [average](test/average) | `fun [XArray](test/-x-array/index)&lt;out&nbsp;Byte&gt;.average(): Double`
+`fun [XArray](test/-x-array/index)&lt;out&nbsp;Double&gt;.average(): Double`
+`fun [XArray](test/-x-array/index)&lt;out&nbsp;Float&gt;.average(): Double`
+`fun [XArray](test/-x-array/index)&lt;out&nbsp;Int&gt;.average(): Double`
+`fun [XArray](test/-x-array/index)&lt;out&nbsp;Long&gt;.average(): Double`
+`fun [XArray](test/-x-array/index)&lt;out&nbsp;Short&gt;.average(): Double` |
+