From 30f7396803aa27edf5cd8cb1fcd531b909a01db4 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Mon, 22 May 2017 16:32:59 +0300 Subject: [PATCH] [NI] Substitute lambda return type with current substitutor We should do this because return type even it still not proper can contain fixed type variables --- .../calls/components/KotlinCallCompleter.kt | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index 68de9906799..5a1ecf7b8ca 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -257,20 +257,8 @@ class KotlinCallCompleter( for (innerCall in lambda.resultArguments) { // todo strange code -- why top-level kotlinCall? may be it isn't right outer call - CheckArguments.checkArgument(topLevelCallContext, topLevelCall, c.getBuilder(), innerCall, lambda.returnType) + CheckArguments.checkArgument(topLevelCallContext, topLevelCall, c.getBuilder(), innerCall, lambda.returnType.let(::substitute)) } -// when (innerCall) { -// is ResolvedKotlinCall.CompletedResolvedKotlinCall -> { -// val returnType = innerCall.completedCall.lastCall.resultingDescriptor.returnTypeOrNothing -// constraintInjector.addInitialSubtypeConstraint(injectorContext, returnType, lambda.returnType, position) -// } -// is ResolvedKotlinCall.OnlyResolvedKotlinCall -> { -// // todo register call -// val returnType = innerCall.candidate.lastCall.descriptorWithFreshTypes.returnTypeOrNothing -// c.addInnerCall(innerCall) -// constraintInjector.addInitialSubtypeConstraint(injectorContext, returnType, lambda.returnType, position) -// } -// } } private fun canWeAnalyzeIt(c: Context, lambda: ResolvedLambdaArgument): Boolean {