diff options
-rw-r--r-- | core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt | 4 | ||||
-rw-r--r-- | core/src/test/kotlin/basic/DRITest.kt | 76 |
2 files changed, 73 insertions, 7 deletions
diff --git a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt index dd2d1681..173e13ac 100644 --- a/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt +++ b/core/src/main/kotlin/transformers/descriptors/DefaultDescriptorToDocumentationTranslator.kt @@ -81,7 +81,7 @@ open class DokkaDescriptorVisitor( fun enumDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Enum { val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo() - val scope = descriptor.getMemberScope(emptyList()) + val scope = descriptor.unsubstitutedMemberScope val descriptorData = descriptor.takeUnless { it.isExpect }?.resolveClassDescriptionData() return Enum( @@ -105,7 +105,7 @@ open class DokkaDescriptorVisitor( fun classDescriptor(descriptor: ClassDescriptor, parent: DRIWithPlatformInfo): Class { val driWithPlatform = parent.dri.withClass(descriptor.name.asString()).withEmptyInfo() - val scope = descriptor.getMemberScope(emptyList()) + val scope = descriptor.unsubstitutedMemberScope val descriptorData = descriptor.takeUnless { it.isExpect }?.resolveClassDescriptionData() val expected = descriptor.takeIf { it.isExpect }?.resolveClassDescriptionData() val actual = listOfNotNull(descriptorData) diff --git a/core/src/test/kotlin/basic/DRITest.kt b/core/src/test/kotlin/basic/DRITest.kt index 93a874ef..c7dc85fb 100644 --- a/core/src/test/kotlin/basic/DRITest.kt +++ b/core/src/test/kotlin/basic/DRITest.kt @@ -1,11 +1,13 @@ package basic import org.jetbrains.dokka.links.* +import org.jetbrains.dokka.pages.ContentPage +import org.jetbrains.dokka.pages.asSequence import org.junit.Assert.assertEquals import org.junit.Test import testApi.testRunner.AbstractCoreTest -class DRITest: AbstractCoreTest() { +class DRITest : AbstractCoreTest() { @Test fun `#634`() { val configuration = dokkaConfiguration { @@ -28,10 +30,12 @@ class DRITest: AbstractCoreTest() { configuration ) { documentablesMergingStage = { module -> - val expected = TypeConstructor("kotlin.Function1", listOf( - TypeParam(listOf(Nullable(TypeConstructor("kotlin.Any", emptyList())))), - Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) - )) + val expected = TypeConstructor( + "kotlin.Function1", listOf( + TypeParam(listOf(Nullable(TypeConstructor("kotlin.Any", emptyList())))), + Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + ) + ) val actual = module.packages.single() .functions.single() .dri.callable?.params?.single() @@ -99,4 +103,66 @@ class DRITest: AbstractCoreTest() { } } } + + @Test + fun `#642 with * and Any?`() { + val configuration = dokkaConfiguration { + passes { + pass { + analysisPlatform = "js" + sourceRoots = listOf("src/") + } + } + } + + testInline( + """ + |/src/main/kotlin/Test.kt + | + |open class Bar<Z> + |class ReBarBar : Bar<StringBuilder>() + |class Foo<out T : Comparable<*>, R : List<Bar<*>>> + | + |fun <T : Comparable<Any?>> Foo<T, *>.qux(): String = TODO() + |fun <T : Comparable<*>> Foo<T, *>.qux(): String = TODO() + | + """.trimMargin(), + configuration + ) { + pagesGenerationStage = { module -> + // DRI(//qux/Foo[TypeParam(bounds=[kotlin.Comparable[kotlin.Any?]]),kotlin.Any?]#//) + val expectedDRI = DRI( + "", + null, + Callable( + "qux", + TypeConstructor( + "Foo", + listOf( + TypeParam( + listOf( + TypeConstructor( + "kotlin.Comparable", + listOf( + Nullable(TypeConstructor("kotlin.Any", emptyList())) + ) + ) + ) + ), + Nullable(TypeConstructor("kotlin.Any", emptyList())) + ) + ), + emptyList() + ) + ) + + val driCount = module + .asSequence() + .filterIsInstance<ContentPage>() + .sumBy { it.dri.count { dri -> dri == expectedDRI } } + + assertEquals(1, driCount) + } + } + } }
\ No newline at end of file |