From f35ebd7d322ee864ca5e183c7dd17a07df074028 Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Fri, 26 Jun 2020 03:07:35 +0200 Subject: Fix primary constructor in signature --- .../kotlin/signatures/KotlinSignatureProvider.kt | 34 ++++++++++++---------- .../base/src/main/resources/dokka/styles/style.css | 3 +- .../SkippingParenthesisForConstructorsTest.kt | 5 ++-- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'plugins') diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index 5a497878..493aa403 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -159,22 +159,24 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog } if (c is WithConstructors) { val pConstructor = c.constructors.singleOrNull { it.extra[PrimaryConstructorExtra] != null } - if (pConstructor?.annotations()?.values?.any { it.isNotEmpty() } == true) { - text(nbsp.toString()) - annotationsInline(pConstructor) - text("constructor") - } - list( - pConstructor?.parameters.orEmpty(), - "(", - ")", - ",", - pConstructor?.sourceSets.orEmpty().toSet() - ) { - annotationsInline(it) - text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold)) - text(": ") - signatureForProjection(it.type) + if (pConstructor?.sourceSets?.contains(sourceSet) == true) { + if (pConstructor.annotations().values.any { it.isNotEmpty() }) { + text(nbsp.toString()) + annotationsInline(pConstructor) + text("constructor") + } + list( + pConstructor.parameters, + "(", + ")", + ",", + pConstructor.sourceSets.toSet() + ) { + annotationsInline(it) + text(it.name ?: "", styles = mainStyles.plus(TextStyle.Bold)) + text(": ") + signatureForProjection(it.type) + } } } if (c is WithSupertypes) { diff --git a/plugins/base/src/main/resources/dokka/styles/style.css b/plugins/base/src/main/resources/dokka/styles/style.css index 1ccd9cbc..f599ffee 100644 --- a/plugins/base/src/main/resources/dokka/styles/style.css +++ b/plugins/base/src/main/resources/dokka/styles/style.css @@ -821,8 +821,7 @@ td.content { } .brief-with-platform-tags { - display: flex; - flex-direction: column; + display: inline-block; width: 100%; } diff --git a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt index 05c408ab..d203025b 100644 --- a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt +++ b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt @@ -150,8 +150,8 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { |package test | |class SomeClass(a: String) { - | constructor - | + | constructor() + |} """.trimIndent(), testConfiguration ) { pagesTransformationStage = { module -> @@ -186,7 +186,6 @@ class ConstructorsSignaturesTest : AbstractCoreTest() { } skipAllNotMatching() } - } } } -- cgit