aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-10-27 14:38:34 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-10-29 11:57:20 +0100
commite6b76322ce8a5526194005a2b6756ed81d3fb550 (patch)
tree1aa23fb04a5b160169beb96fdb16c327384fafef
parentcf0932d7ef77ccecb438dabeb0f2c83e4bbe8dbc (diff)
downloaddokka-e6b76322ce8a5526194005a2b6756ed81d3fb550.tar.gz
dokka-e6b76322ce8a5526194005a2b6756ed81d3fb550.tar.bz2
dokka-e6b76322ce8a5526194005a2b6756ed81d3fb550.zip
correctly render star projections
-rw-r--r--src/Kotlin/DocumentationBuilder.kt10
-rw-r--r--test/data/format/starProjection.kt3
-rw-r--r--test/data/format/starProjection.md8
-rw-r--r--test/src/format/MarkdownFormatTest.kt6
4 files changed, 25 insertions, 2 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index b1aef822..a9ac8551 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -296,7 +296,12 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
}
fun DocumentationNode.appendProjection(projection: TypeProjection, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type) {
- appendType(projection.type, kind, projection.projectionKind.label)
+ if (projection.isStarProjection) {
+ appendTextNode("*", Kind.Type)
+ }
+ else {
+ appendType(projection.type, kind, projection.projectionKind.label)
+ }
}
fun DocumentationNode.appendType(jetType: KtType?, kind: DocumentationNode.Kind = DocumentationNode.Kind.Type, prefix: String = "") {
@@ -329,8 +334,9 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
append(node, DocumentationReference.Kind.Detail)
node.appendAnnotations(jetType)
- for (typeArgument in jetType.arguments)
+ for (typeArgument in jetType.arguments) {
node.appendProjection(typeArgument)
+ }
}
fun ClassifierDescriptor.isBoringBuiltinClass(): Boolean =
diff --git a/test/data/format/starProjection.kt b/test/data/format/starProjection.kt
new file mode 100644
index 00000000..1532c830
--- /dev/null
+++ b/test/data/format/starProjection.kt
@@ -0,0 +1,3 @@
+public inline fun Iterable<*>.containsFoo(element: Any?): Boolean {
+ return false
+}
diff --git a/test/data/format/starProjection.md b/test/data/format/starProjection.md
new file mode 100644
index 00000000..10114081
--- /dev/null
+++ b/test/data/format/starProjection.md
@@ -0,0 +1,8 @@
+[test](test/index) / [Iterable](test/-iterable/index)
+
+
+### Extensions for Iterable
+
+
+| [containsFoo](test/-iterable/contains-foo) | `inline fun Iterable&lt;*&gt;.containsFoo(element:&nbsp;Any?): Boolean` |
+
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index 32a641ff..76ead835 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -168,6 +168,12 @@ public class MarkdownFormatTest {
}
}
+ @Test fun starProjection() {
+ verifyOutput("test/data/format/starProjection.kt", ".md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+
@Test fun extensionFunctionParameter() {
verifyOutput("test/data/format/extensionFunctionParameter.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)