From 91b5b4cc19a4ef6155cadba04ad016625402b00e Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Tue, 18 Feb 2020 11:59:52 +0100 Subject: Fixes not recognizing star projection in dris --- core/src/main/kotlin/links/DRI.kt | 6 +++++- plugins/base/src/test/kotlin/basic/DRITest.kt | 15 ++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index b7e5dd1c..220ed719 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -101,7 +101,7 @@ sealed class TypeReference { private fun fromProjection(t: TypeProjection, r: KotlinType? = null): TypeReference = if (t.isStarProjection) { - Nullable(TypeConstructor("kotlin.Any", emptyList())) + StarProjection } else { fromPossiblyNullable(t.type, r) } @@ -130,6 +130,10 @@ data class Nullable(val wrapped: TypeReference) : TypeReference() { override fun toString() = "$wrapped?" } +object StarProjection: TypeReference() { + override fun toString() = "*" +} + private operator fun List.component6(): T = get(5) private val KotlinType.constructorName diff --git a/plugins/base/src/test/kotlin/basic/DRITest.kt b/plugins/base/src/test/kotlin/basic/DRITest.kt index c7dc85fb..eb65c47b 100644 --- a/plugins/base/src/test/kotlin/basic/DRITest.kt +++ b/plugins/base/src/test/kotlin/basic/DRITest.kt @@ -130,26 +130,23 @@ class DRITest : AbstractCoreTest() { configuration ) { pagesGenerationStage = { module -> - // DRI(//qux/Foo[TypeParam(bounds=[kotlin.Comparable[kotlin.Any?]]),kotlin.Any?]#//) + // DRI(//qux/Foo[TypeParam(bounds=[kotlin.Comparable[kotlin.Any?]]),*]#//) val expectedDRI = DRI( "", null, Callable( - "qux", - TypeConstructor( - "Foo", - listOf( + "qux", TypeConstructor( + "Foo", listOf( TypeParam( listOf( TypeConstructor( - "kotlin.Comparable", - listOf( + "kotlin.Comparable", listOf( Nullable(TypeConstructor("kotlin.Any", emptyList())) ) ) ) ), - Nullable(TypeConstructor("kotlin.Any", emptyList())) + StarProjection ) ), emptyList() @@ -165,4 +162,4 @@ class DRITest : AbstractCoreTest() { } } } -} \ No newline at end of file +} -- cgit