diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-01-08 15:09:46 +0100 |
---|---|---|
committer | Marcin Aman <marcin.aman@gmail.com> | 2021-01-08 15:09:46 +0100 |
commit | 8602e2bb41eb78210677971e7535b0103000b58d (patch) | |
tree | 961557b8877940ea6226f8336630513cfa6d566e | |
parent | afb1f44a76558c6997558b64a766e2f7bc2a9d36 (diff) | |
download | dokka-8602e2bb41eb78210677971e7535b0103000b58d.tar.gz dokka-8602e2bb41eb78210677971e7535b0103000b58d.tar.bz2 dokka-8602e2bb41eb78210677971e7535b0103000b58d.zip |
Fix displaying unresolved receiver types in DRI
-rw-r--r-- | kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt index aae1f189..169831d4 100644 --- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt +++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt @@ -9,6 +9,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.TypeProjection +import org.jetbrains.kotlin.types.UnresolvedType fun TypeReference.Companion.from(d: ReceiverParameterDescriptor): TypeReference? = when (d.value) { @@ -33,8 +34,14 @@ private fun TypeReference.Companion.fromPossiblyRecursive(t: KotlinType, paramTr ?.let(::RecursiveType) ?: from(t, paramTrace) -private fun TypeReference.Companion.from(t: KotlinType, paramTrace: List<KotlinType>): TypeReference = - when (val d = t.constructor.declarationDescriptor) { +private fun TypeReference.Companion.from(t: KotlinType, paramTrace: List<KotlinType>): TypeReference { + if (t is UnresolvedType) { + println("Unresolved type with presentable name: ${t.presentableName}") + return TypeConstructor( + t.presentableName, t.arguments.map { fromProjection(it, paramTrace) } + ) + } + return when (val d = t.constructor.declarationDescriptor) { is TypeParameterDescriptor -> TypeParam( d.upperBounds.map { fromPossiblyNullable(it, paramTrace + t) } ) @@ -43,6 +50,7 @@ private fun TypeReference.Companion.from(t: KotlinType, paramTrace: List<KotlinT t.arguments.map { fromProjection(it, paramTrace) } ) } +} private fun TypeReference.Companion.fromProjection(t: TypeProjection, paramTrace: List<KotlinType>): TypeReference = if (t.isStarProjection) { |