Extract type preparation during type checking to a separate component
This commit is contained in:
+2
@@ -257,6 +257,8 @@ class ConstraintInjector(
|
||||
}
|
||||
}
|
||||
|
||||
override fun prepareType(type: KotlinTypeMarker) = baseContext.prepareType(type)
|
||||
|
||||
fun runIsSubtypeOf(
|
||||
lowerType: KotlinTypeMarker,
|
||||
upperType: KotlinTypeMarker,
|
||||
|
||||
+2
-2
@@ -74,8 +74,8 @@ fun <T> SimpleConstraintSystem.isSignatureNotLessSpecific(
|
||||
* Here, when we try solve this CS(Y is variables) then Array<out X> <: Array<out Y> and this system impossible to solve,
|
||||
* so we capture types from receiver and value parameters.
|
||||
*/
|
||||
val specificCapturedType =
|
||||
context.prepareType(specificType).let { if (captureFromArgument) context.captureFromExpression(it) ?: it else it }
|
||||
val specificCapturedType = AbstractTypeChecker.prepareType(context, specificType)
|
||||
.let { if (captureFromArgument) context.captureFromExpression(it) ?: it else it }
|
||||
addSubtypeConstraint(specificCapturedType, substitutedGeneralType)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -86,7 +86,7 @@ abstract class AbstractTypeApproximator(
|
||||
|
||||
return cachedValue(type, conf, toSuper = true) {
|
||||
approximateTo(
|
||||
prepareType(type), conf, { upperBound() },
|
||||
AbstractTypeChecker.prepareType(ctx, type), conf, { upperBound() },
|
||||
referenceApproximateToSuperType, depth
|
||||
)
|
||||
}
|
||||
@@ -97,7 +97,7 @@ abstract class AbstractTypeApproximator(
|
||||
|
||||
return cachedValue(type, conf, toSuper = false) {
|
||||
approximateTo(
|
||||
prepareType(type), conf, { lowerBound() },
|
||||
AbstractTypeChecker.prepareType(ctx, type), conf, { lowerBound() },
|
||||
referenceApproximateToSubType, depth
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user