[NI] Update lambda result arguments after resolution.

This commit is contained in:
Stanislav Erokhin
2017-05-24 21:17:52 +03:00
committed by Mikhail Zarechenskiy
parent b9e9243e9d
commit 85248676d2
6 changed files with 66 additions and 53 deletions
@@ -37,8 +37,6 @@ interface KotlinResolutionCallbacks {
// todo this is hack for some client which try to read ResolvedCall from trace before all calls completed
fun bindStubResolvedCallForCandidate(candidate: KotlinResolutionCandidate)
fun completeLambdaReturnType(lambdaArgument: ResolvedLambdaArgument, returnType: KotlinType)
fun completeCallableReference(callableReferenceArgument: ResolvedCallableReferenceArgument,
resultTypeParameters: List<UnwrappedType>)
@@ -114,12 +114,12 @@ class KotlinCallCompleter(
it.candidate.toCompletedCall(currentSubstitutor)
}
c.lambdaArguments.forEach {
resolutionCallbacks.completeLambdaReturnType(it, currentSubstitutor.safeSubstitute(it.returnType))
it.finalReturnType = currentSubstitutor.safeSubstitute(it.returnType)
}
c.callableReferenceArguments.forEach {
resolutionCallbacks.completeCallableReference(it, it.myTypeVariables.map { currentSubstitutor.safeSubstitute(it.defaultType) })
}
return ResolvedKotlinCall.CompletedResolvedKotlinCall(completedCall, competedCalls)
return ResolvedKotlinCall.CompletedResolvedKotlinCall(completedCall, competedCalls, c.lambdaArguments)
}
private fun KotlinResolutionCandidate.toCompletedCall(substitutor: NewTypeSubstitutor): CompletedKotlinCall {
@@ -48,6 +48,7 @@ class ResolvedLambdaArgument(
override val outputType: UnwrappedType get() = returnType
lateinit var resultArguments: List<KotlinCallArgument>
lateinit var finalReturnType: UnwrappedType
}
class ResolvedCallableReferenceArgument(
@@ -27,7 +27,8 @@ import org.jetbrains.kotlin.types.UnwrappedType
sealed class ResolvedKotlinCall {
class CompletedResolvedKotlinCall(
val completedCall: CompletedKotlinCall,
val allInnerCalls: Collection<CompletedKotlinCall>
val allInnerCalls: Collection<CompletedKotlinCall>,
val lambdaArguments: List<ResolvedLambdaArgument>
): ResolvedKotlinCall()
class OnlyResolvedKotlinCall(