From 0c7ed042608c0d0c6fe510fb49147c6c5bdf0f50 Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 5 May 2020 22:15:09 -0700 Subject: [PATCH] FIR: make (K)SuspendFunctionX derived from (K)Function --- .../kotlin/fir/resolve/impl/FirBuiltinSymbolProvider.kt | 9 ++++++++- .../function/getArityViaFunctionImpl.kt | 1 - .../testData/codegen/box/coroutines/reflect/bigArity.kt | 1 - .../codegen/box/coroutines/reflect/callSuspend.kt | 1 - .../codegen/box/coroutines/reflect/callSuspendBy.kt | 1 - 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirBuiltinSymbolProvider.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirBuiltinSymbolProvider.kt index eefcd1339b7..0e2880c05a0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirBuiltinSymbolProvider.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/impl/FirBuiltinSymbolProvider.kt @@ -235,7 +235,10 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider: ) FunctionClassDescriptor.Kind.SuspendFunction -> listOf( - session.builtinTypes.anyType + buildResolvedTypeRef { + type = ConeClassLikeLookupTagImpl(StandardClassIds.Function) + .constructClassType(arrayOf(typeArguments.last().type), isNullable = false) + } ) FunctionClassDescriptor.Kind.KFunction -> listOf( @@ -247,6 +250,10 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider: ) FunctionClassDescriptor.Kind.KSuspendFunction -> listOf( + buildResolvedTypeRef { + type = ConeClassLikeLookupTagImpl(StandardClassIds.KFunction) + .constructClassType(arrayOf(typeArguments.last().type), isNullable = false) + }, createSuperType(FunctionClassDescriptor.Kind.SuspendFunction) ) } diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt index eb7dad0e383..3c91191df61 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/getArityViaFunctionImpl.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // IGNORE_LIGHT_ANALYSIS // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/coroutines/reflect/bigArity.kt b/compiler/testData/codegen/box/coroutines/reflect/bigArity.kt index b55bfb2e149..293a6e247db 100644 --- a/compiler/testData/codegen/box/coroutines/reflect/bigArity.kt +++ b/compiler/testData/codegen/box/coroutines/reflect/bigArity.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // TARGET_BACKEND: JVM // WITH_REFLECT // WITH_COROUTINES diff --git a/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt b/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt index 88931d232cb..558bbc26d6a 100644 --- a/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt +++ b/compiler/testData/codegen/box/coroutines/reflect/callSuspend.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_COROUTINES // WITH_REFLECT // TARGET_BACKEND: JVM diff --git a/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt b/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt index 9d7019479e8..25de0f7a0cf 100644 --- a/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt +++ b/compiler/testData/codegen/box/coroutines/reflect/callSuspendBy.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_COROUTINES // WITH_REFLECT // TARGET_BACKEND: JVM