aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorMarcin Aman <marcin.aman@gmail.com>2021-05-06 11:09:42 +0200
committerGitHub <noreply@github.com>2021-05-06 11:09:42 +0200
commit76c26f3325ebe0c06779fca09bbef0eefac5aa5a (patch)
tree2b39bcd386c90fe6311224acd0c3c765974dacb7 /plugins/base
parent326048cd6ed3334a84e489dac8c692bc184709c0 (diff)
downloaddokka-76c26f3325ebe0c06779fca09bbef0eefac5aa5a.tar.gz
dokka-76c26f3325ebe0c06779fca09bbef0eefac5aa5a.tar.bz2
dokka-76c26f3325ebe0c06779fca09bbef0eefac5aa5a.zip
Bump compiler to 1.5.0 (#1856)
* Bump compiler to 1.5.0 * Include Api changes
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt3
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt34
-rw-r--r--plugins/base/src/test/kotlin/model/InheritorsTest.kt35
3 files changed, 57 insertions, 15 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index 4ddd2d39..92ffd9b6 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -901,10 +901,11 @@ private class DokkaDescriptorVisitor(
private fun ClassDescriptor.additionalExtras() = listOfNotNull(
ExtraModifiers.KotlinOnlyModifiers.Inline.takeIf { isInline },
+ ExtraModifiers.KotlinOnlyModifiers.Value.takeIf { isValue },
ExtraModifiers.KotlinOnlyModifiers.External.takeIf { isExternal },
ExtraModifiers.KotlinOnlyModifiers.Inner.takeIf { isInner },
ExtraModifiers.KotlinOnlyModifiers.Data.takeIf { isData },
- ExtraModifiers.KotlinOnlyModifiers.Fun.takeIf { isFun }
+ ExtraModifiers.KotlinOnlyModifiers.Fun.takeIf { isFun },
).toSet()
private fun ValueParameterDescriptor.additionalExtras() = listOfNotNull(
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index 34857ad8..b05ed4fb 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -553,4 +553,38 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
}
}
}
+
+ @Test
+ fun `inline classes`() {
+ inlineModelTest(
+ """
+ | inline class X(val example: String)
+ |
+ | @JvmInline
+ | value class InlineTest(val x: String)
+ """.trimMargin()
+ ) {
+ val classlike = packages.flatMap { it.classlikes }.first() as DClass
+ classlike.name equals "X"
+ classlike.properties.first().name equals "example"
+ classlike.extra[AdditionalModifiers]?.content?.values?.firstOrNull()
+ ?.firstOrNull() equals ExtraModifiers.KotlinOnlyModifiers.Inline
+ }
+ }
+
+ @Test
+ fun `value classes`() {
+ inlineModelTest(
+ """
+ | @JvmInline
+ | value class InlineTest(val example: String)
+ """.trimMargin()
+ ) {
+ val classlike = packages.flatMap { it.classlikes }.first() as DClass
+ classlike.name equals "InlineTest"
+ classlike.properties.first().name equals "example"
+ classlike.extra[AdditionalModifiers]?.content?.values?.firstOrNull()
+ ?.firstOrNull() equals ExtraModifiers.KotlinOnlyModifiers.Value
+ }
+ }
}
diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
index 503cf50c..2b0aff62 100644
--- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt
+++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt
@@ -1,33 +1,22 @@
package model
-import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.Platform
-import org.jetbrains.dokka.base.transformers.documentables.InheritorsExtractorTransformer
import org.jetbrains.dokka.base.transformers.documentables.InheritorsInfo
+import org.jetbrains.dokka.model.DClass
import org.jetbrains.dokka.model.DInterface
-import org.jetbrains.dokka.plugability.DokkaPlugin
import org.junit.jupiter.api.Assertions.assertTrue
-import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
import utils.AbstractModelTest
import utils.assertNotNull
class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", "inheritors") {
- object InheritorsPlugin : DokkaPlugin() {
- val inheritors by extending {
- CoreExtensions.documentableTransformer with InheritorsExtractorTransformer()
- }
- }
-
- @Disabled("reenable after fixing subtypes")
@Test
fun simple() {
inlineModelTest(
"""|interface A{}
|class B() : A {}
""".trimMargin(),
- pluginsOverrides = listOf(InheritorsPlugin)
) {
with((this / "inheritors" / "A").cast<DInterface>()) {
val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value
@@ -40,7 +29,26 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
}
}
- @Disabled("reenable after fixing subtypes")
+ @Test
+ fun sealed() {
+ inlineModelTest(
+ """|sealed class A {}
+ |class B() : A() {}
+ |class C() : A() {}
+ |class D()
+ """.trimMargin(),
+ ) {
+ with((this / "inheritors" / "A").cast<DClass>()) {
+ val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value
+ with(map.keys.also { it counts 1 }.find { it.analysisPlatform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }
+ ) {
+ this counts 2
+ mapNotNull { it.classNames }.sorted() equals listOf("B", "C")
+ }
+ }
+ }
+ }
+
@Test
fun multiplatform() {
val configuration = dokkaConfiguration {
@@ -71,7 +79,6 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt",
""".trimMargin(),
configuration,
cleanupOutput = false,
- pluginOverrides = listOf(InheritorsPlugin)
) {
documentablesTransformationStage = { m ->
with((m / "inheritors" / "A").cast<DInterface>()) {