[NI] Fix substitution in builder-inference for empty common system
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ interface InferenceSession {
|
||||
lambda: ResolvedLambdaAtom,
|
||||
initialStorage: ConstraintStorage,
|
||||
diagnosticsHolder: KotlinDiagnosticsHolder
|
||||
): Map<TypeConstructor, UnwrappedType>
|
||||
): Map<TypeConstructor, UnwrappedType>?
|
||||
|
||||
fun writeOnlyStubs(callInfo: SingleCallResolutionResult): Boolean
|
||||
fun callCompleted(resolvedAtom: ResolvedAtom): Boolean
|
||||
|
||||
+4
@@ -159,6 +159,10 @@ class PostponedArgumentsAnalyzer(
|
||||
val storageSnapshot = c.getBuilder().currentStorage()
|
||||
|
||||
val postponedVariables = inferenceSession.inferPostponedVariables(lambda, storageSnapshot, diagnosticHolder)
|
||||
if (postponedVariables == null) {
|
||||
c.getBuilder().removePostponedVariables()
|
||||
return
|
||||
}
|
||||
|
||||
for ((constructor, resultType) in postponedVariables) {
|
||||
val variableWithConstraints = storageSnapshot.notFixedTypeVariables[constructor] ?: continue
|
||||
|
||||
+1
@@ -34,6 +34,7 @@ interface ConstraintSystemOperation {
|
||||
fun registerVariable(variable: TypeVariableMarker)
|
||||
fun markPostponedVariable(variable: TypeVariableMarker)
|
||||
fun unmarkPostponedVariable(variable: TypeVariableMarker)
|
||||
fun removePostponedVariables()
|
||||
|
||||
fun addSubtypeConstraint(lowerType: KotlinTypeMarker, upperType: KotlinTypeMarker, position: ConstraintPosition)
|
||||
fun addEqualityConstraint(a: KotlinTypeMarker, b: KotlinTypeMarker, position: ConstraintPosition)
|
||||
|
||||
+4
@@ -103,6 +103,10 @@ class NewConstraintSystemImpl(
|
||||
storage.postponedTypeVariables -= variable
|
||||
}
|
||||
|
||||
override fun removePostponedVariables() {
|
||||
storage.postponedTypeVariables.clear()
|
||||
}
|
||||
|
||||
override fun addSubtypeConstraint(lowerType: KotlinTypeMarker, upperType: KotlinTypeMarker, position: ConstraintPosition) =
|
||||
constraintInjector.addInitialSubtypeConstraint(
|
||||
apply { checkState(State.BUILDING, State.COMPLETION, State.TRANSACTION) },
|
||||
|
||||
Reference in New Issue
Block a user