Initialize builder inference lambda anyway, even a call is inapplicable

^KT-47744 Fixed
This commit is contained in:
Victor Petukhov
2021-07-15 11:17:27 +03:00
committed by teamcityserver
parent 2b0ba6fa40
commit 357fda2efa
19 changed files with 227 additions and 1 deletions
@@ -88,6 +88,8 @@ class DelegatedPropertyInferenceSession(
diagnosticsHolder: KotlinDiagnosticsHolder
): Map<TypeConstructor, UnwrappedType> = emptyMap()
override fun initializeLambda(lambda: ResolvedLambdaAtom) {}
override fun writeOnlyStubs(callInfo: SingleCallResolutionResult): Boolean = false
override fun shouldCompleteResolvedSubAtomsOf(resolvedCallAtom: ResolvedCallAtom) = true
@@ -124,4 +126,6 @@ class InferenceSessionForExistingCandidates(
): ConstraintSystemCompletionMode? = null
override fun resolveReceiverIndependently(): Boolean = resolveReceiverIndependently
override fun initializeLambda(lambda: ResolvedLambdaAtom) {}
}
@@ -223,13 +223,17 @@ class BuilderInferenceSession(
return ComposedSubstitutor(currentSubstitutor, createNonFixedTypeToVariableSubstitutor())
}
override fun initializeLambda(lambda: ResolvedLambdaAtom) {
this.lambda = lambda
}
override fun inferPostponedVariables(
lambda: ResolvedLambdaAtom,
initialStorage: ConstraintStorage,
completionMode: ConstraintSystemCompletionMode,
diagnosticsHolder: KotlinDiagnosticsHolder,
): Map<TypeConstructor, UnwrappedType>? {
this.lambda = lambda
initializeLambda(lambda)
fun getResultingSubstitutor(): NewTypeSubstitutor {
val storageSubstitutor = initialStorage.buildResultingSubstitutor(commonSystem, transformTypeVariablesToErrorTypes = false)