Inference. Add parent builder inference constraints only once
This commit is contained in:
+11
-11
@@ -328,17 +328,6 @@ class BuilderInferenceSession(
|
|||||||
commonSystem.registerTypeVariableIfNotPresent(it.typeVariable)
|
commonSystem.registerTypeVariableIfNotPresent(it.typeVariable)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (parentSession in findAllParentBuildInferenceSessions()) {
|
|
||||||
for ((variable, stubType) in parentSession.stubsForPostponedVariables) {
|
|
||||||
commonSystem.registerTypeVariableIfNotPresent(variable)
|
|
||||||
commonSystem.addSubtypeConstraint(
|
|
||||||
variable.defaultType,
|
|
||||||
stubType,
|
|
||||||
InjectedAnotherStubTypeConstraintPositionImpl(lambdaArgument)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* storage can contain the following substitutions:
|
* storage can contain the following substitutions:
|
||||||
* TypeVariable(A) -> ProperType
|
* TypeVariable(A) -> ProperType
|
||||||
@@ -435,6 +424,17 @@ class BuilderInferenceSession(
|
|||||||
private fun initializeCommonSystem(initialStorage: ConstraintStorage): Boolean {
|
private fun initializeCommonSystem(initialStorage: ConstraintStorage): Boolean {
|
||||||
val nonFixedToVariablesSubstitutor = createNonFixedTypeToVariableSubstitutor()
|
val nonFixedToVariablesSubstitutor = createNonFixedTypeToVariableSubstitutor()
|
||||||
|
|
||||||
|
for (parentSession in findAllParentBuildInferenceSessions()) {
|
||||||
|
for ((variable, stubType) in parentSession.stubsForPostponedVariables) {
|
||||||
|
commonSystem.registerTypeVariableIfNotPresent(variable)
|
||||||
|
commonSystem.addSubtypeConstraint(
|
||||||
|
variable.defaultType,
|
||||||
|
stubType,
|
||||||
|
InjectedAnotherStubTypeConstraintPositionImpl(lambdaArgument)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
integrateConstraints(initialStorage, nonFixedToVariablesSubstitutor, false)
|
integrateConstraints(initialStorage, nonFixedToVariablesSubstitutor, false)
|
||||||
|
|
||||||
for (call in commonCalls) {
|
for (call in commonCalls) {
|
||||||
|
|||||||
Reference in New Issue
Block a user