Make getUpperBoundsAsType an utility, remove from TypeParameterDescriptor
This commit is contained in:
@@ -47,7 +47,7 @@ fun FuzzyType.isAlmostEverything(): Boolean {
|
||||
if (freeParameters.isEmpty()) return false
|
||||
val typeParameter = type.constructor.declarationDescriptor as? TypeParameterDescriptor ?: return false
|
||||
if (typeParameter !in freeParameters) return false
|
||||
return typeParameter.upperBoundsAsType.isAnyOrNullableAny()
|
||||
return typeParameter.upperBounds.singleOrNull()?.isAnyOrNullableAny() ?: false
|
||||
}
|
||||
|
||||
class FuzzyType(
|
||||
|
||||
@@ -21,17 +21,14 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
import org.jetbrains.kotlin.idea.refactoring.memberInfo.getClassDescriptorIfAny
|
||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||
import org.jetbrains.kotlin.psi.KtClassOrObject
|
||||
import org.jetbrains.kotlin.psi.KtNamedDeclaration
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.utils.collectDescriptorsFiltered
|
||||
import org.jetbrains.kotlin.types.TypeConstructor
|
||||
import org.jetbrains.kotlin.types.TypeProjection
|
||||
import org.jetbrains.kotlin.types.TypeProjectionImpl
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.substitutions.getTypeSubstitution
|
||||
import org.jetbrains.kotlin.utils.keysToMap
|
||||
import java.util.*
|
||||
@@ -60,7 +57,7 @@ class KotlinPullUpData(val sourceClass: KtClassOrObject,
|
||||
val substitution = LinkedHashMap<TypeConstructor, TypeProjection>()
|
||||
|
||||
typeParametersInSourceClassContext.forEach {
|
||||
substitution[it.typeConstructor] = TypeProjectionImpl(it.upperBoundsAsType)
|
||||
substitution[it.typeConstructor] = TypeProjectionImpl(TypeIntersector.getUpperBoundsAsType(it))
|
||||
}
|
||||
|
||||
val superClassSubstitution = getTypeSubstitution(targetClassDescriptor.defaultType, sourceClassDescriptor.defaultType)
|
||||
@@ -77,4 +74,4 @@ class KotlinPullUpData(val sourceClass: KtClassOrObject,
|
||||
}
|
||||
|
||||
val isInterfaceTarget: Boolean = targetClassDescriptor.kind == ClassKind.INTERFACE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user