diff options
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 10 | ||||
-rw-r--r-- | test/data/format/starProjection.kt | 3 | ||||
-rw-r--r-- | test/data/format/starProjection.md | 8 | ||||
-rw-r--r-- | test/src/format/MarkdownFormatTest.kt | 6 |
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<*>.containsFoo(element: 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) |