FIR: Lookup contained postponed atoms recursively in delegate inference

This commit is contained in:
Simon Ogorodnik
2021-11-23 15:49:38 +03:00
committed by teamcity
parent 26b158bded
commit 1a288fcdcd
@@ -195,8 +195,15 @@ class FirDelegatedPropertyInferenceSession(
notCompletedCalls as List<FirStatement>,
unitType, resolutionContext
) { lambdaAtom ->
val containingCandidateForLambda = notCompletedCalls.first {
it.candidate.postponedAtoms.contains(lambdaAtom)
// Reversed here bc we want top-most call to avoid exponential visit
val containingCandidateForLambda = notCompletedCalls.asReversed().first {
var found = false
it.processAllContainingCallCandidates(processBlocks = true) { subCandidate ->
if (subCandidate.postponedAtoms.contains(lambdaAtom)) {
found = true
}
}
found
}.candidate
postponedArgumentsAnalyzer.analyze(
commonSystem.asPostponedArgumentsAnalyzerContext(),