Changed default value for 'getNestedTypeVariables()'

This commit is contained in:
Svetlana Isakova
2015-07-08 12:30:22 +03:00
parent 722a49767a
commit d2dc44379e
4 changed files with 6 additions and 6 deletions
@@ -69,7 +69,7 @@ private fun CallableDescriptor.hasReturnTypeDependentOnUninferredParams(constrai
val returnType = getReturnType() ?: return false
val nestedTypeVariables = with (constraintSystem as ConstraintSystemImpl) {
returnType.getNestedTypeVariables(original = true)
returnType.getNestedTypeVariables()
}
return nestedTypeVariables.any { constraintSystem.getTypeBounds(it).value == null }
}
@@ -164,7 +164,7 @@ class GenericCandidateResolver(
val returnType = candidateDescriptor.getReturnType() ?: return false
val nestedTypeVariables = with (argumentConstraintSystem) {
returnType.getNestedTypeVariables(original = true)
returnType.getNestedTypeVariables()
}
// we add an additional type variable only if no information is inferred for it.
// otherwise we add currently inferred return type as before
@@ -167,7 +167,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
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 ->
typeProjection.getType().getConstructor().getDeclarationDescriptor() as? TypeParameterDescriptor
}.filterNotNull().filter { if (original) it in originalToVariables.keySet() else it in getAllTypeVariables() }
@@ -344,7 +344,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
typeBounds.addBound(bound)
if (!bound.isProper) {
for (dependentTypeVariable in bound.constrainingType.getNestedTypeVariables()) {
for (dependentTypeVariable in bound.constrainingType.getNestedTypeVariables(original = false)) {
val dependentBounds = usedInBounds.getOrPut(dependentTypeVariable) { arrayListOf() }
dependentBounds.add(bound)
}
@@ -477,7 +477,7 @@ public class ConstraintSystemImpl : ConstraintSystem {
if (typeBounds.isFixed) return
typeBounds.setFixed()
val nestedTypeVariables = typeBounds.bounds.flatMap { it.constrainingType.getNestedTypeVariables() }
val nestedTypeVariables = typeBounds.bounds.flatMap { it.constrainingType.getNestedTypeVariables(original = false) }
nestedTypeVariables.forEach { fixVariable(it) }
val value = typeBounds.value ?: return
@@ -89,7 +89,7 @@ private fun ConstraintSystemImpl.generateNewBound(bound: Bound, substitution: Bo
fun addNewBound(newConstrainingType: JetType, newBoundKind: BoundKind) {
// We don't generate new recursive constraints
val nestedTypeVariables = newConstrainingType.getNestedTypeVariables()
val nestedTypeVariables = newConstrainingType.getNestedTypeVariables(original = false)
if (nestedTypeVariables.contains(bound.typeVariable)) return
// We don't generate constraint if a type variable was substituted twice