fix compilation (KtType -> KotlinType)
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
|||||||
import org.jetbrains.kotlin.diagnostics.Errors
|
import org.jetbrains.kotlin.diagnostics.Errors
|
||||||
import org.jetbrains.kotlin.psi.KtClass
|
import org.jetbrains.kotlin.psi.KtClass
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
|
||||||
import org.jetbrains.kotlin.types.KtType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.types.TypeConstructor
|
import org.jetbrains.kotlin.types.TypeConstructor
|
||||||
import org.jetbrains.kotlin.types.TypeUtils
|
import org.jetbrains.kotlin.types.TypeUtils
|
||||||
import org.jetbrains.kotlin.types.Variance
|
import org.jetbrains.kotlin.types.Variance
|
||||||
@@ -116,7 +116,7 @@ public object NonExpansiveInheritanceRestrictionChecker {
|
|||||||
// upper bounds of a skolem type variable Q in a skolemization of a projected generic type in ST, add an
|
// upper bounds of a skolem type variable Q in a skolemization of a projected generic type in ST, add an
|
||||||
// expanding edge from T to V, where V is the type parameter corresponding to Q.
|
// expanding edge from T to V, where V is the type parameter corresponding to Q.
|
||||||
val originalTypeParameter = constituentTypeConstructor.parameters[i]
|
val originalTypeParameter = constituentTypeConstructor.parameters[i]
|
||||||
val bounds = hashSetOf<KtType>()
|
val bounds = hashSetOf<KotlinType>()
|
||||||
|
|
||||||
val substitutor = constituentType.substitution.buildSubstitutor()
|
val substitutor = constituentType.substitution.buildSubstitutor()
|
||||||
val adaptedUpperBounds = originalTypeParameter.upperBounds.map { substitutor.substitute(it, Variance.INVARIANT) }.filterNotNull()
|
val adaptedUpperBounds = originalTypeParameter.upperBounds.map { substitutor.substitute(it, Variance.INVARIANT) }.filterNotNull()
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public fun KotlinType.isDefaultBound(): Boolean = KotlinBuiltIns.isDefaultBound(
|
|||||||
public fun createProjection(type: KotlinType, projectionKind: Variance, typeParameterDescriptor: TypeParameterDescriptor?): TypeProjection =
|
public fun createProjection(type: KotlinType, projectionKind: Variance, typeParameterDescriptor: TypeParameterDescriptor?): TypeProjection =
|
||||||
TypeProjectionImpl(if (typeParameterDescriptor?.variance == projectionKind) Variance.INVARIANT else projectionKind, type)
|
TypeProjectionImpl(if (typeParameterDescriptor?.variance == projectionKind) Variance.INVARIANT else projectionKind, type)
|
||||||
|
|
||||||
fun Collection<KtType>.closure(f: (KtType) -> Collection<KtType>): Collection<KtType> {
|
fun Collection<KotlinType>.closure(f: (KotlinType) -> Collection<KotlinType>): Collection<KotlinType> {
|
||||||
if (size == 0) return this
|
if (size == 0) return this
|
||||||
|
|
||||||
val result = HashSet(this)
|
val result = HashSet(this)
|
||||||
@@ -149,7 +149,7 @@ fun Collection<KtType>.closure(f: (KtType) -> Collection<KtType>): Collection<Kt
|
|||||||
var oldSize = 0
|
var oldSize = 0
|
||||||
while (result.size > oldSize) {
|
while (result.size > oldSize) {
|
||||||
oldSize = result.size
|
oldSize = result.size
|
||||||
val toAdd = hashSetOf<KtType>()
|
val toAdd = hashSetOf<KotlinType>()
|
||||||
elementsToCheck.forEach { toAdd.addAll(f(it)) }
|
elementsToCheck.forEach { toAdd.addAll(f(it)) }
|
||||||
result.addAll(toAdd)
|
result.addAll(toAdd)
|
||||||
elementsToCheck = toAdd
|
elementsToCheck = toAdd
|
||||||
@@ -158,16 +158,16 @@ fun Collection<KtType>.closure(f: (KtType) -> Collection<KtType>): Collection<Kt
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun boundClosure(types: Collection<KtType>): Collection<KtType> =
|
fun boundClosure(types: Collection<KotlinType>): Collection<KotlinType> =
|
||||||
types.closure { type -> TypeUtils.getTypeParameterDescriptorOrNull(type)?.upperBounds ?: emptySet() }
|
types.closure { type -> TypeUtils.getTypeParameterDescriptorOrNull(type)?.upperBounds ?: emptySet() }
|
||||||
|
|
||||||
fun constituentTypes(types: Collection<KtType>): Collection<KtType> {
|
fun constituentTypes(types: Collection<KotlinType>): Collection<KotlinType> {
|
||||||
val result = hashSetOf<KtType>()
|
val result = hashSetOf<KotlinType>()
|
||||||
constituentTypes(result, types)
|
constituentTypes(result, types)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun constituentTypes(result: MutableSet<KtType>, types: Collection<KtType>) {
|
private fun constituentTypes(result: MutableSet<KotlinType>, types: Collection<KotlinType>) {
|
||||||
result.addAll(types)
|
result.addAll(types)
|
||||||
for (type in types) {
|
for (type in types) {
|
||||||
if (type.isFlexible()) {
|
if (type.isFlexible()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user