From bca6d8c524a4c1a8174e1e2e301b3cd32d5e8fd4 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 12 Feb 2020 13:49:28 +0100 Subject: Fixes infinite recursion bug for immediate nullable self types --- core/src/test/kotlin/basic/DRITest.kt | 59 +++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'core/src/test/kotlin/basic') diff --git a/core/src/test/kotlin/basic/DRITest.kt b/core/src/test/kotlin/basic/DRITest.kt index f8328e35..93a874ef 100644 --- a/core/src/test/kotlin/basic/DRITest.kt +++ b/core/src/test/kotlin/basic/DRITest.kt @@ -40,4 +40,63 @@ class DRITest: AbstractCoreTest() { } } + @Test + fun `#634 with immediate nullable self`() { + val configuration = dokkaConfiguration { + passes { + pass { + sourceRoots = listOf("src/") + } + } + } + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package toplevel + | + |fun > Array.doSomething(t: T?): Array = TODO() + |} + """.trimMargin(), + configuration + ) { + documentablesMergingStage = { module -> + val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + val actual = module.packages.single() + .functions.single() + .dri.callable?.params?.single() + assertEquals(expected, actual) + } + } + } + + @Test + fun `#634 with generic nullable receiver`() { + val configuration = dokkaConfiguration { + passes { + pass { + sourceRoots = listOf("src/") + } + } + } + + testInline( + """ + |/src/main/kotlin/basic/Test.kt + |package toplevel + | + |fun > T?.doSomethingWithNullable() = TODO() + |} + """.trimMargin(), + configuration + ) { + documentablesMergingStage = { module -> + val expected = Nullable(TypeParam(listOf(TypeConstructor("kotlin.Comparable", listOf(SelfType))))) + val actual = module.packages.single() + .functions.single() + .dri.callable?.receiver + assertEquals(expected, actual) + } + } + } } \ No newline at end of file -- cgit