From f2635289b1923866843e1dd47423bd6ca74c2cb1 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Fri, 21 Aug 2020 16:29:39 +0200 Subject: Replace SelfType with family of RecursiveTypes --- plugins/base/src/test/kotlin/basic/DRITest.kt | 35 ++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt index 7083609a..4e805f48 100644 --- a/plugins/base/src/test/kotlin/basic/DRITest.kt +++ b/plugins/base/src/test/kotlin/basic/DRITest.kt @@ -38,7 +38,7 @@ class DRITest : AbstractCoreTest() { val expected = TypeConstructor( "kotlin.Function1", listOf( TypeParam(listOf(Nullable(TypeConstructor("kotlin.Any", emptyList())))), - Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(RecursiveType(0)))))) ) ) val actual = module.packages.single() @@ -70,7 +70,7 @@ class DRITest : AbstractCoreTest() { configuration ) { documentablesMergingStage = { module -> - val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(RecursiveType(0)))))) val actual = module.packages.single() .functions.single() .dri.callable?.params?.single() @@ -100,7 +100,7 @@ class DRITest : AbstractCoreTest() { configuration ) { documentablesMergingStage = { module -> - val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(RecursiveType(0)))))) val actual = module.packages.single() .functions.single() .dri.callable?.receiver @@ -314,4 +314,33 @@ class DRITest : AbstractCoreTest() { } } } + + @Test + fun `deep recursive typebound #1342`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/") + } + } + } + testInline( + """ + |/src/main/kotlin/Test.kt + |package example + | + | fun recursiveBound(t: T, s: S, r: R) where T: List, S: List, R: List = Unit + | + """.trimMargin(), + configuration + ) { + documentablesMergingStage = { module -> + val function = module.dfs { it.name == "recursiveBound" } + assertEquals( + "example//recursiveBound/#TypeParam(bounds=[kotlin.collections.List[TypeParam(bounds=[kotlin.collections.List[TypeParam(bounds=[kotlin.collections.List[^^]])]])]])#TypeParam(bounds=[kotlin.collections.List[TypeParam(bounds=[kotlin.collections.List[^]])]])#TypeParam(bounds=[kotlin.collections.List[TypeParam(bounds=[kotlin.collections.List[^]])]])/PointingToDeclaration/", + function?.dri?.toString(), + ) + } + } + } } -- cgit