FIR: replace ConeComposedSubstitutor with ChainedSubstitutor
This commit is contained in:
committed by
teamcity
parent
52145e0623
commit
1e41ec7d22
+2
-8
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.fir.expressions.FirStatement
|
|||||||
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
|
||||||
import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext
|
import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext
|
||||||
import org.jetbrains.kotlin.fir.resolve.inference.model.ConeBuilderInferenceSubstitutionConstraintPosition
|
import org.jetbrains.kotlin.fir.resolve.inference.model.ConeBuilderInferenceSubstitutionConstraintPosition
|
||||||
|
import org.jetbrains.kotlin.fir.resolve.substitution.ChainedSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
|
||||||
import org.jetbrains.kotlin.fir.types.*
|
import org.jetbrains.kotlin.fir.types.*
|
||||||
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
|
import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer
|
||||||
@@ -249,7 +250,7 @@ class FirBuilderInferenceSession(
|
|||||||
private fun updateCalls(commonSystem: NewConstraintSystemImpl) {
|
private fun updateCalls(commonSystem: NewConstraintSystemImpl) {
|
||||||
val nonFixedToVariablesSubstitutor = createNonFixedTypeToVariableSubstitutor()
|
val nonFixedToVariablesSubstitutor = createNonFixedTypeToVariableSubstitutor()
|
||||||
val commonSystemSubstitutor = commonSystem.buildCurrentSubstitutor() as ConeSubstitutor
|
val commonSystemSubstitutor = commonSystem.buildCurrentSubstitutor() as ConeSubstitutor
|
||||||
val nonFixedTypesToResultSubstitutor = ConeComposedSubstitutor(commonSystemSubstitutor, nonFixedToVariablesSubstitutor)
|
val nonFixedTypesToResultSubstitutor = ChainedSubstitutor(nonFixedToVariablesSubstitutor, commonSystemSubstitutor)
|
||||||
|
|
||||||
val stubTypeSubstitutor = FirStubTypeTransformer(nonFixedTypesToResultSubstitutor)
|
val stubTypeSubstitutor = FirStubTypeTransformer(nonFixedTypesToResultSubstitutor)
|
||||||
lambda.transformSingle(stubTypeSubstitutor, null)
|
lambda.transformSingle(stubTypeSubstitutor, null)
|
||||||
@@ -263,13 +264,6 @@ class FirBuilderInferenceSession(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ConeComposedSubstitutor(val left: ConeSubstitutor, val right: ConeSubstitutor) : ConeSubstitutor() {
|
|
||||||
override fun substituteOrNull(type: ConeKotlinType): ConeKotlinType? {
|
|
||||||
val rightSubstitution = right.substituteOrNull(type)
|
|
||||||
return left.substituteOrNull(rightSubstitution ?: type)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FirStubTypeTransformer(
|
class FirStubTypeTransformer(
|
||||||
private val substitutor: ConeSubstitutor
|
private val substitutor: ConeSubstitutor
|
||||||
) : FirDefaultTransformer<Nothing?>() {
|
) : FirDefaultTransformer<Nothing?>() {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// FIR status: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER on lazy call (Name3, T)
|
// FIR status: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER on lazy call (Name3, T)
|
||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user