diff options
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 8 | ||||
-rw-r--r-- | test/data/format/varargsFunction.kt | 1 | ||||
-rw-r--r-- | test/data/format/varargsFunction.md | 12 | ||||
-rw-r--r-- | test/src/format/MarkdownFormatTest.kt | 6 |
4 files changed, 26 insertions, 1 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index a9b017bb..40c6d745 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -293,7 +293,13 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati fun ValueParameterDescriptor.build(): DocumentationNode { val node = DocumentationNode(this, Kind.Parameter) - node.appendType(getType()) + val varargType = getVarargElementType() + if (varargType != null) { + node.append(DocumentationNode("vararg", Content.Empty, Kind.Annotation), DocumentationReference.Kind.Annotation) + node.appendType(varargType) + } else { + node.appendType(getType()) + } node.appendAnnotations(this) register(this, node) return node diff --git a/test/data/format/varargsFunction.kt b/test/data/format/varargsFunction.kt new file mode 100644 index 00000000..deea127b --- /dev/null +++ b/test/data/format/varargsFunction.kt @@ -0,0 +1 @@ +fun f(vararg s: String) {} diff --git a/test/data/format/varargsFunction.md b/test/data/format/varargsFunction.md new file mode 100644 index 00000000..c86132bc --- /dev/null +++ b/test/data/format/varargsFunction.md @@ -0,0 +1,12 @@ +[test](out.md) / [](out.md) / [f](out.md) + + +# f + + +``` +fun f(vararg s: String): Unit +``` + + + diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt index a5a62e13..f7fc6da0 100644 --- a/test/src/format/MarkdownFormatTest.kt +++ b/test/src/format/MarkdownFormatTest.kt @@ -55,4 +55,10 @@ public class MarkdownFormatTest { enumClassNode.members.filter { it.name == "LOCAL_CONTINUE_AND_BREAK" }) } } + + Test fun varargsFunction() { + verifyOutput("test/data/format/varargsFunction.kt", ".md") { model, output -> + markdownService.appendNodes(tempLocation, output, model.members.single().members) + } + } } |