[FE] Substitute fixed type variables with inferred stub types
Actually, a type variable might be fixed into a stub type. Such stub type should be substituted before sub calls completion ^KT-51988 Fixed
This commit is contained in:
committed by
teamcity
parent
92df5cd67f
commit
6027c2a9aa
+3
-2
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.resolve.calls.components
|
||||
|
||||
import org.jetbrains.kotlin.resolve.calls.components.candidate.ResolutionCandidate
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilder
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintSystemCompletionMode
|
||||
import org.jetbrains.kotlin.resolve.calls.inference.model.ConstraintStorage
|
||||
import org.jetbrains.kotlin.resolve.calls.model.*
|
||||
@@ -26,7 +27,7 @@ interface InferenceSession {
|
||||
override fun currentConstraintSystem(): ConstraintStorage = ConstraintStorage.Empty
|
||||
override fun inferPostponedVariables(
|
||||
lambda: ResolvedLambdaAtom,
|
||||
initialStorage: ConstraintStorage,
|
||||
constraintSystemBuilder: ConstraintSystemBuilder,
|
||||
completionMode: ConstraintSystemCompletionMode,
|
||||
diagnosticsHolder: KotlinDiagnosticsHolder
|
||||
): Map<TypeConstructor, UnwrappedType> = emptyMap()
|
||||
@@ -51,7 +52,7 @@ interface InferenceSession {
|
||||
fun currentConstraintSystem(): ConstraintStorage
|
||||
fun inferPostponedVariables(
|
||||
lambda: ResolvedLambdaAtom,
|
||||
initialStorage: ConstraintStorage,
|
||||
constraintSystemBuilder: ConstraintSystemBuilder,
|
||||
completionMode: ConstraintSystemCompletionMode,
|
||||
diagnosticsHolder: KotlinDiagnosticsHolder
|
||||
): Map<TypeConstructor, UnwrappedType>?
|
||||
|
||||
+3
-3
@@ -191,11 +191,11 @@ class PostponedArgumentsAnalyzer(
|
||||
|| languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceWithoutAnnotation)
|
||||
|
||||
if (inferenceSession != null && shouldUseBuilderInference) {
|
||||
val storageSnapshot = c.getBuilder().currentStorage()
|
||||
val constraintSystemBuilder = c.getBuilder()
|
||||
|
||||
val postponedVariables = inferenceSession.inferPostponedVariables(
|
||||
lambda,
|
||||
storageSnapshot,
|
||||
constraintSystemBuilder,
|
||||
completionMode,
|
||||
diagnosticHolder
|
||||
)
|
||||
@@ -205,7 +205,7 @@ class PostponedArgumentsAnalyzer(
|
||||
}
|
||||
|
||||
for ((constructor, resultType) in postponedVariables) {
|
||||
val variableWithConstraints = storageSnapshot.notFixedTypeVariables[constructor] ?: continue
|
||||
val variableWithConstraints = constraintSystemBuilder.currentStorage().notFixedTypeVariables[constructor] ?: continue
|
||||
val variable = variableWithConstraints.typeVariable
|
||||
|
||||
c.getBuilder().unmarkPostponedVariable(variable)
|
||||
|
||||
Reference in New Issue
Block a user