[NI] Store stub resolved call to trace because some clients read this before all calls are completed.

This is bad idea, but this is how it works in old inference.
Now we just save old behaviour.
Future plan: fix checks where we get unfinished resolved calls.
This commit is contained in:
Stanislav Erokhin
2017-04-06 15:45:00 +03:00
parent 78f8d29a4c
commit c4ddc7a3a6
6 changed files with 63 additions and 11 deletions
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.resolve.calls.components
import org.jetbrains.kotlin.descriptors.CallableDescriptor
import org.jetbrains.kotlin.resolve.calls.model.KotlinCall
import org.jetbrains.kotlin.resolve.calls.model.KotlinCallArgument
import org.jetbrains.kotlin.resolve.calls.model.KotlinResolutionCandidate
import org.jetbrains.kotlin.resolve.calls.model.LambdaKotlinCallArgument
import org.jetbrains.kotlin.types.UnwrappedType
@@ -34,4 +35,8 @@ interface LambdaAnalyzer {
parameters: List<UnwrappedType>,
expectedReturnType: UnwrappedType? // null means, that return type is not proper i.e. it depends on some type variables
): List<KotlinCallArgument>
// todo this is hack for some client which try to read ResolvedCall from trace before all calls completed
fun bindStubResolvedCallForCandidate(candidate: KotlinResolutionCandidate)
}
@@ -69,6 +69,7 @@ class KotlinCallCompleter(
expectedType: UnwrappedType?,
lambdaAnalyzer: LambdaAnalyzer
): ResolvedKotlinCall {
lambdaAnalyzer.bindStubResolvedCallForCandidate(candidate)
val topLevelCall =
if (candidate is VariableAsFunctionKotlinResolutionCandidate) {
candidate.invokeCandidate