FIR: Use only successful calls for constraints in delegate inference

This commit is contained in:
Simon Ogorodnik
2021-11-22 15:58:32 +03:00
committed by teamcity
parent 64944a1247
commit c3c4404bc5
@@ -52,12 +52,16 @@ class FirDelegatedPropertyInferenceSession(
override fun <T> addCompletedCall(call: T, candidate: Candidate) where T : FirResolvable, T : FirStatement { override fun <T> addCompletedCall(call: T, candidate: Candidate) where T : FirResolvable, T : FirStatement {
partiallyResolvedCalls += call to candidate partiallyResolvedCalls += call to candidate
integrateResolvedCall(candidate.system.asReadOnlyStorage()) if (candidate.isSuccessful) {
integrateResolvedCall(candidate.system.asReadOnlyStorage())
}
} }
override fun <T> addPartiallyResolvedCall(call: T) where T : FirResolvable, T : FirStatement { override fun <T> addPartiallyResolvedCall(call: T) where T : FirResolvable, T : FirStatement {
super.addPartiallyResolvedCall(call) super.addPartiallyResolvedCall(call)
integrateResolvedCall(call.candidate.system.currentStorage()) if (call.candidate.isSuccessful) {
integrateResolvedCall(call.candidate.system.currentStorage())
}
} }
override fun <T> shouldRunCompletion(call: T): Boolean where T : FirResolvable, T : FirStatement { override fun <T> shouldRunCompletion(call: T): Boolean where T : FirResolvable, T : FirStatement {
@@ -167,12 +171,14 @@ class FirDelegatedPropertyInferenceSession(
val stubToTypeVariableSubstitutor = createNonFixedTypeToVariableSubstitutor() val stubToTypeVariableSubstitutor = createNonFixedTypeToVariableSubstitutor()
for ((call, candidate) in partiallyResolvedCalls) { for ((call, candidate) in partiallyResolvedCalls) {
integrateConstraints( if (candidate.isSuccessful) {
commonSystem, integrateConstraints(
candidate.system.asReadOnlyStorage(), commonSystem,
stubToTypeVariableSubstitutor, candidate.system.asReadOnlyStorage(),
call.candidate() != null stubToTypeVariableSubstitutor,
) call.candidate() != null
)
}
} }