Changed default value for 'getNestedTypeVariables()'
This commit is contained in:
@@ -69,7 +69,7 @@ private fun CallableDescriptor.hasReturnTypeDependentOnUninferredParams(constrai
|
|||||||
val returnType = getReturnType() ?: return false
|
val returnType = getReturnType() ?: return false
|
||||||
|
|
||||||
val nestedTypeVariables = with (constraintSystem as ConstraintSystemImpl) {
|
val nestedTypeVariables = with (constraintSystem as ConstraintSystemImpl) {
|
||||||
returnType.getNestedTypeVariables(original = true)
|
returnType.getNestedTypeVariables()
|
||||||
}
|
}
|
||||||
return nestedTypeVariables.any { constraintSystem.getTypeBounds(it).value == null }
|
return nestedTypeVariables.any { constraintSystem.getTypeBounds(it).value == null }
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -164,7 +164,7 @@ class GenericCandidateResolver(
|
|||||||
val returnType = candidateDescriptor.getReturnType() ?: return false
|
val returnType = candidateDescriptor.getReturnType() ?: return false
|
||||||
|
|
||||||
val nestedTypeVariables = with (argumentConstraintSystem) {
|
val nestedTypeVariables = with (argumentConstraintSystem) {
|
||||||
returnType.getNestedTypeVariables(original = true)
|
returnType.getNestedTypeVariables()
|
||||||
}
|
}
|
||||||
// we add an additional type variable only if no information is inferred for it.
|
// we add an additional type variable only if no information is inferred for it.
|
||||||
// otherwise we add currently inferred return type as before
|
// otherwise we add currently inferred return type as before
|
||||||
|
|||||||
+3
-3
@@ -167,7 +167,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
|
|||||||
type -> type.getConstructor().getDeclarationDescriptor() in getAllTypeVariables()
|
type -> type.getConstructor().getDeclarationDescriptor() in getAllTypeVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun JetType.getNestedTypeVariables(original: Boolean = false): List<TypeParameterDescriptor> {
|
fun JetType.getNestedTypeVariables(original: Boolean = true): List<TypeParameterDescriptor> {
|
||||||
return getNestedArguments().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() }
|
||||||
@@ -344,7 +344,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
|
|||||||
typeBounds.addBound(bound)
|
typeBounds.addBound(bound)
|
||||||
|
|
||||||
if (!bound.isProper) {
|
if (!bound.isProper) {
|
||||||
for (dependentTypeVariable in bound.constrainingType.getNestedTypeVariables()) {
|
for (dependentTypeVariable in bound.constrainingType.getNestedTypeVariables(original = false)) {
|
||||||
val dependentBounds = usedInBounds.getOrPut(dependentTypeVariable) { arrayListOf() }
|
val dependentBounds = usedInBounds.getOrPut(dependentTypeVariable) { arrayListOf() }
|
||||||
dependentBounds.add(bound)
|
dependentBounds.add(bound)
|
||||||
}
|
}
|
||||||
@@ -477,7 +477,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
|
|||||||
if (typeBounds.isFixed) return
|
if (typeBounds.isFixed) return
|
||||||
typeBounds.setFixed()
|
typeBounds.setFixed()
|
||||||
|
|
||||||
val nestedTypeVariables = typeBounds.bounds.flatMap { it.constrainingType.getNestedTypeVariables() }
|
val nestedTypeVariables = typeBounds.bounds.flatMap { it.constrainingType.getNestedTypeVariables(original = false) }
|
||||||
nestedTypeVariables.forEach { fixVariable(it) }
|
nestedTypeVariables.forEach { fixVariable(it) }
|
||||||
|
|
||||||
val value = typeBounds.value ?: return
|
val value = typeBounds.value ?: return
|
||||||
|
|||||||
+1
-1
@@ -89,7 +89,7 @@ private fun ConstraintSystemImpl.generateNewBound(bound: Bound, substitution: Bo
|
|||||||
|
|
||||||
fun addNewBound(newConstrainingType: JetType, newBoundKind: BoundKind) {
|
fun addNewBound(newConstrainingType: JetType, newBoundKind: BoundKind) {
|
||||||
// We don't generate new recursive constraints
|
// We don't generate new recursive constraints
|
||||||
val nestedTypeVariables = newConstrainingType.getNestedTypeVariables()
|
val nestedTypeVariables = newConstrainingType.getNestedTypeVariables(original = false)
|
||||||
if (nestedTypeVariables.contains(bound.typeVariable)) return
|
if (nestedTypeVariables.contains(bound.typeVariable)) return
|
||||||
|
|
||||||
// We don't generate constraint if a type variable was substituted twice
|
// We don't generate constraint if a type variable was substituted twice
|
||||||
|
|||||||
Reference in New Issue
Block a user