diff options
author | Andrzej Ratajczak <32793002+BarkingBad@users.noreply.github.com> | 2020-10-05 18:14:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 18:14:27 +0200 |
commit | 9eeaa967e526e7beae4de9c9b8b09ce26ff00293 (patch) | |
tree | 3fe2d30598ad1cf20bc270bc8156076311f7a908 /plugins | |
parent | 0235c0ee12deaffed1d69ebaad86d24e5e48d9df (diff) | |
download | dokka-9eeaa967e526e7beae4de9c9b8b09ce26ff00293.tar.gz dokka-9eeaa967e526e7beae4de9c9b8b09ce26ff00293.tar.bz2 dokka-9eeaa967e526e7beae4de9c9b8b09ce26ff00293.zip |
Fix vararg signatures (#1516)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt | 2 | ||||
-rw-r--r-- | plugins/base/src/test/kotlin/signatures/SignatureTest.kt | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt index d64a7b29..e1ba3cea 100644 --- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt @@ -633,7 +633,7 @@ private class DokkaDescriptorVisitor( DParameter( dri = parent.dri.copy(target = PointingToCallableParameters(index)), name = descriptor.name.asString(), - type = descriptor.type.toBound(), + type = descriptor.varargElementType?.toBound() ?: descriptor.type.toBound(), expectPresentInSet = null, documentation = descriptor.resolveDescriptorData(), sourceSets = setOf(sourceSet), diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt index b8be54aa..f8c17794 100644 --- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt +++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt @@ -179,6 +179,24 @@ class SignatureTest : AbstractCoreTest() { } @Test + fun `fun with vararg`() { + val source = source("fun simpleFun(vararg params: Int): Unit") + val writerPlugin = TestOutputWriterPlugin() + + testInline( + source, + configuration, + pluginOverrides = listOf(writerPlugin) + ) { + renderingStage = { _, _ -> + writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match( + "fun ", A("simpleFun"), "(vararg params: ", A("Int"), ")", Span() + ) + } + } + } + + @Test fun `class with no supertype`() { val source = source("class SimpleClass") val writerPlugin = TestOutputWriterPlugin() |