Rename: getNestedTypeArguments -> getNestedArguments
This commit is contained in:
+2
-2
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.types.TypeUtils.DONT_CARE
|
|||||||
import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
import org.jetbrains.kotlin.types.checker.JetTypeChecker
|
||||||
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedure
|
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedure
|
||||||
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedureCallbacks
|
import org.jetbrains.kotlin.types.checker.TypeCheckingProcedureCallbacks
|
||||||
import org.jetbrains.kotlin.types.typeUtil.getNestedTypeArguments
|
import org.jetbrains.kotlin.types.typeUtil.getNestedArguments
|
||||||
import java.util.ArrayList
|
import java.util.ArrayList
|
||||||
import java.util.HashMap
|
import java.util.HashMap
|
||||||
import java.util.HashSet
|
import java.util.HashSet
|
||||||
@@ -168,7 +168,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun JetType.getNestedTypeVariables(original: Boolean = false): List<TypeParameterDescriptor> {
|
fun JetType.getNestedTypeVariables(original: Boolean = false): List<TypeParameterDescriptor> {
|
||||||
return getNestedTypeArguments().map { typeProjection ->
|
return getNestedArguments().map { typeProjection ->
|
||||||
typeProjection.getType().getConstructor().getDeclarationDescriptor() as? TypeParameterDescriptor
|
typeProjection.getType().getConstructor().getDeclarationDescriptor() as? TypeParameterDescriptor
|
||||||
}.filterNotNull().filter { if (original) it in originalToVariables.keySet() else it in getAllTypeVariables() }
|
}.filterNotNull().filter { if (original) it in originalToVariables.keySet() else it in getAllTypeVariables() }
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.TypeBounds.BoundKind.UPPER_B
|
|||||||
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.CompoundConstraintPosition
|
import org.jetbrains.kotlin.resolve.calls.inference.constraintPosition.CompoundConstraintPosition
|
||||||
import org.jetbrains.kotlin.types.*
|
import org.jetbrains.kotlin.types.*
|
||||||
import org.jetbrains.kotlin.types.Variance.INVARIANT
|
import org.jetbrains.kotlin.types.Variance.INVARIANT
|
||||||
import org.jetbrains.kotlin.types.typeUtil.getNestedTypeArguments
|
import org.jetbrains.kotlin.types.typeUtil.getNestedArguments
|
||||||
import org.jetbrains.kotlin.types.typesApproximation.approximateCapturedTypes
|
import org.jetbrains.kotlin.types.typesApproximation.approximateCapturedTypes
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ private fun ConstraintSystemImpl.generateNewBound(bound: Bound, substitution: Bo
|
|||||||
// todo
|
// todo
|
||||||
// if we allow non-trivial type projections, we bump into errors like
|
// if we allow non-trivial type projections, we bump into errors like
|
||||||
// "Empty intersection for types [MutableCollection<in ('Int'..'Int?')>, MutableCollection<out Any?>, MutableCollection<in Int>]"
|
// "Empty intersection for types [MutableCollection<in ('Int'..'Int?')>, MutableCollection<out Any?>, MutableCollection<in Int>]"
|
||||||
fun JetType.containsConstrainingTypeWithoutProjection() = this.getNestedTypeArguments().any {
|
fun JetType.containsConstrainingTypeWithoutProjection() = this.getNestedArguments().any {
|
||||||
it.getType().getConstructor() == substitution.constrainingType.getConstructor() && it.getProjectionKind() == Variance.INVARIANT
|
it.getType().getConstructor() == substitution.constrainingType.getConstructor() && it.getProjectionKind() == Variance.INVARIANT
|
||||||
}
|
}
|
||||||
if (approximationBounds.upper.containsConstrainingTypeWithoutProjection() && bound.kind != LOWER_BOUND) {
|
if (approximationBounds.upper.containsConstrainingTypeWithoutProjection() && bound.kind != LOWER_BOUND) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public fun JetTypeChecker.equalTypesOrNulls(type1: JetType?, type2: JetType?): B
|
|||||||
return equalTypes(type1, type2)
|
return equalTypes(type1, type2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JetType.getNestedTypeArguments(): List<TypeProjection> {
|
fun JetType.getNestedArguments(): List<TypeProjection> {
|
||||||
val result = ArrayList<TypeProjection>()
|
val result = ArrayList<TypeProjection>()
|
||||||
|
|
||||||
val stack = ArrayDeque<TypeProjection>()
|
val stack = ArrayDeque<TypeProjection>()
|
||||||
|
|||||||
Reference in New Issue
Block a user