From 126b634529d1206253b3cbcdb64ee9439bc377d7 Mon Sep 17 00:00:00 2001 From: Dmitriy Dolovov Date: Thu, 4 Mar 2021 02:30:20 +0300 Subject: [PATCH] [Commonizer] Drop support of descriptors, part 2 --- .../cir/factory/CirAnnotationFactory.kt | 36 +---- .../commonizer/cir/factory/CirClassFactory.kt | 23 +--- .../cir/factory/CirConstantValueFactory.kt | 50 ------- .../cir/factory/CirTypeAliasFactory.kt | 15 --- .../commonizer/cir/factory/CirTypeFactory.kt | 124 +----------------- .../cir/factory/CirTypeParameterFactory.kt | 9 -- .../descriptors/commonizer/utils/names.kt | 9 -- .../descriptors/commonizer/utils/type.kt | 38 ------ 8 files changed, 12 insertions(+), 292 deletions(-) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirAnnotationFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirAnnotationFactory.kt index 55e02a73aae..6aa9215f04e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirAnnotationFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirAnnotationFactory.kt @@ -10,48 +10,16 @@ import kotlinx.metadata.Flag import kotlinx.metadata.Flags import kotlinx.metadata.KmAnnotation import kotlinx.metadata.KmAnnotationArgument -import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirAnnotationImpl import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirProvided -import org.jetbrains.kotlin.descriptors.commonizer.utils.* +import org.jetbrains.kotlin.descriptors.commonizer.utils.Interner import org.jetbrains.kotlin.descriptors.commonizer.utils.compact -import org.jetbrains.kotlin.name.Name -import org.jetbrains.kotlin.resolve.constants.AnnotationValue -import org.jetbrains.kotlin.resolve.constants.ConstantValue +import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMap object CirAnnotationFactory { private val interner = Interner() - fun create(source: AnnotationDescriptor): CirAnnotation { - val type = CirTypeFactory.create(source.type) as CirClassType - - val allValueArguments: Map> = source.allValueArguments - if (allValueArguments.isEmpty()) - return create(type = type, constantValueArguments = emptyMap(), annotationValueArguments = emptyMap()) - - val constantValueArguments: MutableMap> = THashMap(allValueArguments.size) - val annotationValueArguments: MutableMap = THashMap(allValueArguments.size) - - allValueArguments.forEach { (name, constantValue) -> - val cirName = CirName.create(name) - if (constantValue is AnnotationValue) - annotationValueArguments[cirName] = create(source = constantValue.value) - else - constantValueArguments[cirName] = CirConstantValueFactory.createSafely( - constantValue = constantValue, - constantName = cirName, - owner = source, - ) - } - - return create( - type = type, - constantValueArguments = constantValueArguments.compact(), - annotationValueArguments = annotationValueArguments.compact() - ) - } - fun createAnnotations(flags: Flags, typeResolver: CirTypeResolver, annotations: () -> List): List { return if (!Flag.Common.HAS_ANNOTATIONS(flags)) emptyList() diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt index 2410d537265..d87ed8de0ee 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirClassFactory.kt @@ -9,7 +9,10 @@ import kotlinx.metadata.Flag import kotlinx.metadata.KmAnnotation import kotlinx.metadata.KmClass import kotlinx.metadata.klib.annotations -import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.DescriptorVisibility +import org.jetbrains.kotlin.descriptors.Modality import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassImpl import org.jetbrains.kotlin.descriptors.commonizer.metadata.decodeClassKind @@ -17,26 +20,8 @@ import org.jetbrains.kotlin.descriptors.commonizer.metadata.decodeModality import org.jetbrains.kotlin.descriptors.commonizer.metadata.decodeVisibility import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMap import org.jetbrains.kotlin.descriptors.commonizer.utils.filteredSupertypes -import org.jetbrains.kotlin.resolve.isInlineClass object CirClassFactory { - fun create(source: ClassDescriptor): CirClass = create( - annotations = source.annotations.compactMap(CirAnnotationFactory::create), - name = CirName.create(source.name), - typeParameters = source.declaredTypeParameters.compactMap(CirTypeParameterFactory::create), - visibility = source.visibility, - modality = source.modality, - kind = source.kind, - companion = source.companionObjectDescriptor?.name?.let(CirName::create), - isCompanion = source.isCompanionObject, - isData = source.isData, - isInline = source.isInlineClass(), - isInner = source.isInner, - isExternal = source.isExternal - ).apply { - setSupertypes(source.filteredSupertypes.compactMap { CirTypeFactory.create(it) }) - } - fun create(name: CirName, source: KmClass, typeResolver: CirTypeResolver): CirClass = create( annotations = CirAnnotationFactory.createAnnotations(source.flags, typeResolver, source::annotations), name = name, diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirConstantValueFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirConstantValueFactory.kt index 3ef51226e11..3a14e24154a 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirConstantValueFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirConstantValueFactory.kt @@ -10,58 +10,8 @@ import org.jetbrains.kotlin.descriptors.commonizer.cir.CirConstantValue import org.jetbrains.kotlin.descriptors.commonizer.cir.CirEntityId import org.jetbrains.kotlin.descriptors.commonizer.cir.CirName import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMapIndexed -import org.jetbrains.kotlin.resolve.constants.* object CirConstantValueFactory { - fun createSafely( - constantValue: ConstantValue<*>, - constantName: CirName? = null, - owner: Any, - ): CirConstantValue<*> = createSafely( - constantValue = constantValue, - location = { "${owner::class.java}, $owner" + constantName?.toString()?.let { "[$it]" } } - ) - - private fun createSafely( - constantValue: ConstantValue<*>, - location: () -> String - ): CirConstantValue<*> = when (constantValue) { - is NullValue -> CirConstantValue.NullValue - - is StringValue -> CirConstantValue.StringValue(constantValue.value) - is CharValue -> CirConstantValue.CharValue(constantValue.value) - - is ByteValue -> CirConstantValue.ByteValue(constantValue.value) - is ShortValue -> CirConstantValue.ShortValue(constantValue.value) - is IntValue -> CirConstantValue.IntValue(constantValue.value) - is LongValue -> CirConstantValue.LongValue(constantValue.value) - - is UByteValue -> CirConstantValue.UByteValue(constantValue.value) - is UShortValue -> CirConstantValue.UShortValue(constantValue.value) - is UIntValue -> CirConstantValue.UIntValue(constantValue.value) - is ULongValue -> CirConstantValue.ULongValue(constantValue.value) - - is FloatValue -> CirConstantValue.FloatValue(constantValue.value) - is DoubleValue -> CirConstantValue.DoubleValue(constantValue.value) - is BooleanValue -> CirConstantValue.BooleanValue(constantValue.value) - - is EnumValue -> CirConstantValue.EnumValue( - CirEntityId.create(constantValue.enumClassId), - CirName.create(constantValue.enumEntryName) - ) - - is ArrayValue -> CirConstantValue.ArrayValue( - constantValue.value.compactMapIndexed { index, innerConstantValue -> - createSafely( - constantValue = innerConstantValue, - location = { "${location()}[$index]" } - ) - } - ) - - else -> error("Unsupported const value type: ${constantValue::class.java}, $constantValue at ${location()}") - } - fun createSafely( constantValue: KmAnnotationArgument<*>?, constantName: CirName? = null, diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeAliasFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeAliasFactory.kt index d445eea6412..c1a4c914b4e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeAliasFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeAliasFactory.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory import kotlinx.metadata.KmTypeAlias -import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirTypeAliasImpl @@ -14,20 +13,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.metadata.decodeVisibility import org.jetbrains.kotlin.descriptors.commonizer.utils.compactMap object CirTypeAliasFactory { - fun create(source: TypeAliasDescriptor): CirTypeAlias { - val underlyingType = CirTypeFactory.create(source.underlyingType) as CirClassOrTypeAliasType - val expandedType = CirTypeFactory.unabbreviate(underlyingType) - - return create( - annotations = source.annotations.compactMap(CirAnnotationFactory::create), - name = CirName.create(source.name), - typeParameters = source.declaredTypeParameters.compactMap(CirTypeParameterFactory::create), - visibility = source.visibility, - underlyingType = underlyingType, - expandedType = expandedType - ) - } - fun create(name: CirName, source: KmTypeAlias, typeResolver: CirTypeResolver): CirTypeAlias { val underlyingType = CirTypeFactory.create(source.underlyingType, typeResolver) as CirClassOrTypeAliasType val expandedType = CirTypeFactory.unabbreviate(underlyingType) diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt index 4c29b5b4313..0281ed4d0a7 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeFactory.kt @@ -7,17 +7,17 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory import gnu.trove.TIntObjectHashMap import kotlinx.metadata.* -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.annotations.Annotations +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.DescriptorVisibility import org.jetbrains.kotlin.descriptors.commonizer.cir.* import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirClassTypeImpl import org.jetbrains.kotlin.descriptors.commonizer.cir.impl.CirTypeAliasTypeImpl +import org.jetbrains.kotlin.descriptors.commonizer.core.computeExpandedType import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirProvided import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.CirProvidedClassifiers import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.TypeParameterResolver -import org.jetbrains.kotlin.descriptors.commonizer.core.computeExpandedType import org.jetbrains.kotlin.descriptors.commonizer.utils.* -import org.jetbrains.kotlin.types.* +import org.jetbrains.kotlin.types.Variance object CirTypeFactory { object StandardTypes { @@ -84,58 +84,6 @@ object CirTypeFactory { } } - fun create(source: KotlinType): CirType = source.unwrap().run { - when (this) { - is SimpleType -> create(this) - is FlexibleType -> CirFlexibleType(create(lowerBound), create(upperBound)) - } - } - - fun create(source: SimpleType): CirSimpleType { - if (source is AbbreviatedType) { - val abbreviation = source.abbreviation - when (val classifierDescriptor = abbreviation.declarationDescriptor) { - is TypeAliasDescriptor -> { - return createTypeAliasType( - typeAliasId = classifierDescriptor.classifierId, - underlyingType = create(extractExpandedType(source)) as CirClassOrTypeAliasType, - arguments = createArguments(abbreviation.arguments), - isMarkedNullable = abbreviation.isMarkedNullable - ) - } - else -> error("Unexpected classifier descriptor type for abbreviation type: ${classifierDescriptor::class.java}, $classifierDescriptor, ${source.abbreviation}") - } - } - - return when (val classifierDescriptor = source.declarationDescriptor) { - is ClassDescriptor -> createClassTypeWithAllOuterTypes( - classDescriptor = classifierDescriptor, - arguments = createArguments(source.arguments), - isMarkedNullable = source.isMarkedNullable - ) - is TypeAliasDescriptor -> { - val abbreviatedType = TypeAliasExpander.NON_REPORTING.expand( - TypeAliasExpansion.create(null, classifierDescriptor, source.arguments), - Annotations.EMPTY - ) as AbbreviatedType - - val expandedType = extractExpandedType(abbreviatedType) - - val cirExpandedType = create(expandedType) as CirClassOrTypeAliasType - val cirExpandedTypeWithProperNullability = makeNullableIfNecessary(cirExpandedType, source.isMarkedNullable) - - createTypeAliasType( - typeAliasId = classifierDescriptor.classifierId, - underlyingType = cirExpandedTypeWithProperNullability, - arguments = createArguments(source.arguments), - isMarkedNullable = source.isMarkedNullable - ) - } - is TypeParameterDescriptor -> createTypeParameterType(classifierDescriptor.typeParameterIndex, source.isMarkedNullable) - else -> error("Unexpected classifier descriptor type: ${classifierDescriptor::class.java}, $classifierDescriptor, $source") - } - } - fun createClassType( classId: CirEntityId, outerType: CirClassType?, @@ -226,7 +174,7 @@ object CirTypeFactory { fun unabbreviate(type: CirClassOrTypeAliasType): CirClassType = when (type) { is CirClassType -> { var hasAbbreviationsInArguments = false - val unabreviatedArguments = type.arguments.compactMap { argument -> + val unabbreviatedArguments = type.arguments.compactMap { argument -> val argumentType = (argument as? CirTypeProjectionImpl)?.type as? CirClassOrTypeAliasType ?: return@compactMap argument val unabbreviatedArgumentType = unabbreviate(argumentType) @@ -252,55 +200,13 @@ object CirTypeFactory { classId = type.classifierId, outerType = unabbreviatedOuterType, visibility = type.visibility, - arguments = unabreviatedArguments, + arguments = unabbreviatedArguments, isMarkedNullable = type.isMarkedNullable ) } is CirTypeAliasType -> unabbreviate(computeExpandedType(type)) } - private fun createClassTypeWithAllOuterTypes( - classDescriptor: ClassDescriptor, - arguments: List, - isMarkedNullable: Boolean - ): CirClassType { - val outerType: CirClassType? - val remainingArguments: List - - if (classDescriptor.isInner) { - val declaredTypeParametersCount = classDescriptor.declaredTypeParameters.size - outerType = createClassTypeWithAllOuterTypes( - classDescriptor = classDescriptor.containingDeclaration as ClassDescriptor, - arguments = arguments.subList(declaredTypeParametersCount, arguments.size), - isMarkedNullable = false // don't pass nullable flag to outer types - ) - remainingArguments = arguments.subList(0, declaredTypeParametersCount) - } else { - outerType = null - remainingArguments = arguments - } - - return createClassType( - classId = classDescriptor.classifierId, - outerType = outerType, - visibility = classDescriptor.visibility, - arguments = remainingArguments, - isMarkedNullable = isMarkedNullable - ) - } - - @Suppress("NOTHING_TO_INLINE") - private inline fun createArguments(arguments: List): List = - arguments.compactMap { projection -> - if (projection.isStarProjection) - CirStarTypeProjection - else - CirTypeProjectionImpl( - projectionKind = projection.projectionKind, - type = create(projection.type) - ) - } - @Suppress("NOTHING_TO_INLINE") private inline fun createArguments(arguments: List, typeResolver: CirTypeResolver): List { return arguments.compactMap { argument -> @@ -313,24 +219,6 @@ object CirTypeFactory { ) } } - - private inline val TypeParameterDescriptor.typeParameterIndex: Int - get() { - var index = index - var parent = containingDeclaration - - if (parent is CallableMemberDescriptor) { - parent = parent.containingDeclaration as? ClassifierDescriptorWithTypeParameters ?: return index - index += parent.declaredTypeParameters.size - } - - while (parent is ClassifierDescriptorWithTypeParameters) { - parent = parent.containingDeclaration as? ClassifierDescriptorWithTypeParameters ?: break - index += parent.declaredTypeParameters.size - } - - return index - } } typealias TypeParameterId = Int diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeParameterFactory.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeParameterFactory.kt index 80494fb58e8..c94a0ec4854 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeParameterFactory.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/cir/factory/CirTypeParameterFactory.kt @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.cir.factory import kotlinx.metadata.Flag import kotlinx.metadata.KmTypeParameter import kotlinx.metadata.klib.annotations -import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor import org.jetbrains.kotlin.descriptors.commonizer.cir.CirAnnotation import org.jetbrains.kotlin.descriptors.commonizer.cir.CirName import org.jetbrains.kotlin.descriptors.commonizer.cir.CirType @@ -21,14 +20,6 @@ import org.jetbrains.kotlin.descriptors.commonizer.utils.filteredUpperBounds import org.jetbrains.kotlin.types.Variance object CirTypeParameterFactory { - fun create(source: TypeParameterDescriptor): CirTypeParameter = create( - annotations = source.annotations.compactMap(CirAnnotationFactory::create), - name = CirName.create(source.name), - isReified = source.isReified, - variance = source.variance, - upperBounds = source.filteredUpperBounds.compactMap(CirTypeFactory::create) - ) - fun create(source: KmTypeParameter, typeResolver: CirTypeResolver): CirTypeParameter = create( annotations = CirAnnotationFactory.createAnnotations(ALWAYS_HAS_ANNOTATIONS, typeResolver, source::annotations), name = CirName.create(source.name), diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/names.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/names.kt index e1fb21956f7..cd9cea5d030 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/names.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/names.kt @@ -8,8 +8,6 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils import kotlinx.metadata.ClassName import kotlinx.metadata.KmAnnotation import org.jetbrains.kotlin.builtins.StandardNames -import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor -import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor import org.jetbrains.kotlin.descriptors.commonizer.cir.CirEntityId import org.jetbrains.kotlin.descriptors.commonizer.cir.CirName import org.jetbrains.kotlin.descriptors.commonizer.cir.CirPackageName @@ -73,12 +71,5 @@ internal val CirPackageName.isUnderKotlinNativeSyntheticPackages: Boolean internal val CirEntityId.isObjCInteropCallableAnnotation: Boolean get() = packageName == CINTEROP_PACKAGE && relativeNameSegments.singleOrNull() in OBJC_INTEROP_CALLABLE_ANNOTATIONS -internal val AnnotationDescriptor.isObjCInteropCallableAnnotation: Boolean - get() { - val classifier = type.declarationDescriptor - return CirName.create(classifier.name) in OBJC_INTEROP_CALLABLE_ANNOTATIONS - && (classifier.containingDeclaration as? PackageFragmentDescriptor)?.fqName?.let(CirPackageName::create) == CINTEROP_PACKAGE - } - internal val KmAnnotation.isObjCInteropCallableAnnotation: Boolean get() = className in OBJC_INTEROP_CALLABLE_ANNOTATION_FULL_NAMES diff --git a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/type.kt b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/type.kt index 5c09ed49709..60129e9b79e 100644 --- a/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/type.kt +++ b/native/commonizer/src/org/jetbrains/kotlin/descriptors/commonizer/utils/type.kt @@ -7,50 +7,12 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils import gnu.trove.TIntHashSet import kotlinx.metadata.* -import org.jetbrains.kotlin.builtins.KotlinBuiltIns -import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.descriptors.commonizer.cir.CirEntityId -import org.jetbrains.kotlin.descriptors.commonizer.cir.CirName -import org.jetbrains.kotlin.descriptors.commonizer.cir.CirPackageName import org.jetbrains.kotlin.descriptors.commonizer.cir.CirTypeSignature import org.jetbrains.kotlin.descriptors.commonizer.mergedtree.TypeParameterResolver -import org.jetbrains.kotlin.types.* -import org.jetbrains.kotlin.types.typeUtil.isNullableAny - -internal inline val KotlinType.declarationDescriptor: ClassifierDescriptor - get() = (constructor.declarationDescriptor ?: error("No declaration descriptor found for $constructor")) - -// eliminate unnecessary repeated abbreviations -internal fun extractExpandedType(abbreviated: AbbreviatedType): SimpleType { - var expanded = abbreviated.expandedType - while (expanded is AbbreviatedType) { - if (expanded.abbreviation.declarationDescriptor !== abbreviated.abbreviation.declarationDescriptor) - break - else - expanded = expanded.expandedType - } - return expanded -} - -internal val ClassifierDescriptorWithTypeParameters.classifierId: CirEntityId - get() = when (val owner = containingDeclaration) { - is PackageFragmentDescriptor -> CirEntityId.create( - packageName = CirPackageName.create(owner.fqName), - relativeName = CirName.create(name) - ) - is ClassDescriptor -> owner.classifierId.createNestedEntityId(CirName.create(name)) - else -> error("Unexpected containing declaration type for $this: ${owner::class}, $owner") - } - -internal inline val TypeParameterDescriptor.filteredUpperBounds: List - get() = upperBounds.takeUnless { it.singleOrNull()?.isNullableAny() == true } ?: emptyList() internal inline val KmTypeParameter.filteredUpperBounds: List get() = upperBounds.takeUnless { it.singleOrNull()?.isNullableAny == true } ?: emptyList() -internal inline val ClassDescriptor.filteredSupertypes: Collection - get() = typeConstructor.supertypes.takeUnless { it.size == 1 && KotlinBuiltIns.isAny(it.first()) } ?: emptyList() - internal inline val KmClass.filteredSupertypes: List get() = supertypes.takeUnless { it.singleOrNull()?.isAny == true } ?: emptyList()