From 97bccc0e12fdc8c3bd6d178e17fdfb57c3514489 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Wed, 16 Aug 2023 21:34:59 +0300 Subject: Fix cast to `ClassDescriptor` error (#3118) --- .../descriptors/compiler/impl/DescriptorFullClassHierarchyBuilder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'subprojects') diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/impl/DescriptorFullClassHierarchyBuilder.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/impl/DescriptorFullClassHierarchyBuilder.kt index 22350bfc..d366e797 100644 --- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/impl/DescriptorFullClassHierarchyBuilder.kt +++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/impl/DescriptorFullClassHierarchyBuilder.kt @@ -11,7 +11,7 @@ import org.jetbrains.dokka.utilities.parallelForEach import org.jetbrains.dokka.analysis.kotlin.internal.ClassHierarchy import org.jetbrains.dokka.analysis.kotlin.internal.FullClassHierarchyBuilder import org.jetbrains.dokka.analysis.kotlin.internal.Supertypes -import org.jetbrains.kotlin.descriptors.ClassDescriptor +import org.jetbrains.kotlin.descriptors.ClassifierDescriptorWithTypeParameters import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.typeUtil.immediateSupertypes import org.jetbrains.kotlin.types.typeUtil.isAnyOrNullableAny @@ -72,7 +72,7 @@ internal class DescriptorFullClassHierarchyBuilder : FullClassHierarchyBuilder { // is not enough since it keeps only one level of hierarchy documentable.sources.forEach { (sourceSet, source) -> if (source is DescriptorDocumentableSource) { - val descriptor = source.descriptor as ClassDescriptor + val descriptor = source.descriptor as? ClassifierDescriptorWithTypeParameters ?: return@forEach // it can be typealias as well val type = descriptor.defaultType hierarchy[sourceSet]?.let { collectSupertypesFromKotlinType(documentable.dri to type, it) } } else if (source is PsiDocumentableSource) { -- cgit