FIR: update suspend lambda type during declaration resolution

This commit is contained in:
Jinseong Jeon
2020-09-11 23:05:17 -07:00
committed by Mikhail Glukhikh
parent 680dd64211
commit 0bd7de158c
5 changed files with 8 additions and 6 deletions
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.fir.resolve.calls.InaccessibleImplicitReceiverValue
import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl
import org.jetbrains.kotlin.fir.resolve.inference.FirDelegatedPropertyInferenceSession
import org.jetbrains.kotlin.fir.resolve.inference.extractLambdaInfoFromFunctionalType
import org.jetbrains.kotlin.fir.resolve.inference.isSuspendFunctionType
import org.jetbrains.kotlin.fir.resolve.substitution.ConeSubstitutor
import org.jetbrains.kotlin.fir.resolve.transformers.*
import org.jetbrains.kotlin.fir.scopes.impl.FirLocalScope
@@ -768,7 +769,11 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
inferenceComponents.ctx.commonSuperTypeOrNull(returnTypes) ?: session.builtinTypes.unitType.type
)
)
af.replaceTypeRef(af.constructFunctionalTypeRef())
af.replaceTypeRef(
af.constructFunctionalTypeRef(
isSuspend = expectedTypeRef.coneTypeSafe<ConeKotlinType>()?.isSuspendFunctionType(session) == true
)
)
af.addReturn().compose()
}
is ResolutionMode.WithStatus -> {
@@ -1,10 +1,10 @@
// IGNORE_BACKEND_FIR: JVM_IR
// NB This test depends on line numbers
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FULL_JDK
// WITH_COROUTINES
// IGNORE_BACKEND:
package test // NB This test depends on line numbers
package test
import helpers.*
import kotlin.coroutines.*
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
// IGNORE_BACKEND: JS
// WITH_RUNTIME
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST