From 7aa2125d1ca5b39bc849beec6d0dd84f01c862d2 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 19 Jan 2025 02:50:05 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=B0=B1=E5=B7=AE=E9=82=A3=E4=B9=88?= =?UTF-8?q?=E4=B8=80=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fir/SuspendTransformFirTransformer.kt | 107 ++++++++++++++++-- .../ir/SuspendTransformTransformer.kt | 33 +++--- .../runners/CodeGenTestRunnerGenerated.java | 6 + .../src/testData/codegen/varargParam.kt | 18 +++ 4 files changed, 144 insertions(+), 20 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index e408557..9794db5 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -6,7 +6,7 @@ import love.forte.plugin.suspendtrans.utils.TransformAnnotationData import love.forte.plugin.suspendtrans.utils.toClassId import love.forte.plugin.suspendtrans.utils.toInfo import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol @@ -14,24 +14,25 @@ import org.jetbrains.kotlin.fir.analysis.checkers.processOverriddenFunctions import org.jetbrains.kotlin.fir.caches.FirCache import org.jetbrains.kotlin.fir.caches.firCachesFactory import org.jetbrains.kotlin.fir.caches.getValue -import org.jetbrains.kotlin.fir.collectUpperBounds -import org.jetbrains.kotlin.fir.copy import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.* +import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality -import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression +import org.jetbrains.kotlin.fir.expressions.buildResolvedArgumentList import org.jetbrains.kotlin.fir.expressions.builder.* +import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.plugin.createConeType +import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope @@ -257,7 +258,7 @@ class SuspendTransformFirTransformer( if (annotations.none { it.fqName(session) == targetMarkerAnnotation.asSingleFqName() && (it.argumentMapping.mapping[targetMarkerValueName] as? FirLiteralExpression) - ?.value == markerId + ?.value == markerId }) { replaceAnnotations( buildList { @@ -335,6 +336,8 @@ class SuspendTransformFirTransformer( ) ) + val funTarget = FirFunctionTarget(null, false) + val newFun = buildSimpleFunctionCopy(originFunc) { name = callableId.callableName symbol = newFunSymbol @@ -363,12 +366,100 @@ class SuspendTransformFirTransformer( annotations.clear() annotations.addAll(functionAnnotations) - body = null val returnType = resolveReturnType(originFunc, funData, returnTypeRef) - returnTypeRef = returnType + body = buildBlock { + this.source = originFunc.body?.source + + // lambda: () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.isLambda = true + this.moduleData = originFunc.moduleData + this.origin = key.origin + this.returnTypeRef = originFunc.returnTypeRef + this.hasExplicitParameterList = false + this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.source = originFunc.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunc.source + this.name = originFunc.name + this.resolvedSymbol = originFunc.symbol + } +// this.argumentList = buildArgumentList { +// for (originParam in originFunc.valueParameters) { +// arguments.add(originParam.toQualifiedAccess()) +// } +// } + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + for (originParam in originFunc.valueParameters) { + put(originParam.toQualifiedAccess(), originParam) + } + } + ) + } + } + ) + } + lambdaTarget.bind(lambda) + + this.statements.add(buildAnonymousFunctionExpression { + this.anonymousFunction = lambda + this.isTrailingLambda = false + }) + +// this.statements.add( +// buildReturnExpression { +// this.target = funTarget +// val transformName = with(funData.transformer.transformFunctionInfo) { +// buildString { +// if (packageName.isNotEmpty()) { +// append(packageName) +// append('.') +// } +// if (className?.isNotEmpty() == true) { +// append(className) +// append('.') +// } +// append(functionName) +// } +// } +// +// holder.session.moduleData.dependencies +// +// this.result = buildFunctionCall { +// this.source = null + // TODO 必须 resolved +// this.calleeReference = buildSimpleNamedReference { +// this.source = null +// this.name = Name.identifier(transformName) +// } + // TODO Argument 必须 resolved +//// this.argumentList = buildArgumentList { +//// arguments.add(buildAnonymousFunctionExpression { +//// this.source = lambda.source +//// this.anonymousFunction = lambda +//// this.isTrailingLambda = false +//// }) +//// // TODO scope? +//// } +// } +// } +// ) + // ConeClassLikeType() + } + // body = null + // TODO 是否可以在FIR中就完成Body的构建? // buildBlock { // // build lambda @@ -429,6 +520,8 @@ class SuspendTransformFirTransformer( origin = key.origin } + funTarget.bind(newFun) + if (targetMarkerAnnotation != null) { originFunc.appendTargetMarker(uniqueFunHash) } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 5f9888f..43bbdae 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -95,15 +95,19 @@ class SuspendTransformTransformer( pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) }, callableFunction - )?.also { generatedOriginFunction -> + ).also { generatedOriginFunction -> if (property != null) { // NO! BACKING! FIELD! property.backingField = null } - postProcessGenerateOriginFunction( - generatedOriginFunction, - pluginKey.data.transformer.originFunctionIncludeAnnotations - ) + + if (generatedOriginFunction != null) { + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } } @@ -162,6 +166,11 @@ class SuspendTransformTransformer( crossinline checkIsOriginFunction: (IrFunction) -> Boolean, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrFunction? { + if (function.body != null) { + return null + } + + val parent = function.parent if (parent is IrDeclarationContainer) { @@ -255,14 +264,12 @@ class SuspendTransformTransformer( originFunction.reportLocation() ?: function.reportLocation() ) - if (function.body == null) { - function.body = generateTransformBodyForFunctionLambda( - pluginContext, - function, - originFunction, - transformTargetFunctionCall - ) - } + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + originFunction, + transformTargetFunctionCall + ) return originFunction } diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index d1eb602..505d025 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -67,4 +67,10 @@ public void testImplOverridenGeneric() { public void testAlias() { runTest("src/testData/codegen/alias.kt"); } + + @Test + @TestMetadata("varargParam.kt") + public void testVarargParam() { + runTest("src/testData/codegen/varargParam.kt"); + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt new file mode 100644 index 0000000..a95caea --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt @@ -0,0 +1,18 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +public interface DeleteOption + +abstract class MyClass { + @JvmBlocking + @JvmAsync + suspend open fun deleteAll(vararg options: DeleteOption): Int { + return 1 + } +} From 297506aeead72fb72873cdf84cd639ca71d377a4 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 19 Jan 2025 02:50:05 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=B0=B1=E5=B7=AE=E9=82=A3=E4=B9=88?= =?UTF-8?q?=E4=B8=80=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fir/SuspendTransformFirTransformer.kt | 107 ++++++++++++++++-- .../ir/SuspendTransformTransformer.kt | 33 +++--- .../runners/CodeGenTestRunnerGenerated.java | 6 + .../src/testData/codegen/varargParam.kt | 18 +++ 4 files changed, 144 insertions(+), 20 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index e408557..9794db5 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -6,7 +6,7 @@ import love.forte.plugin.suspendtrans.utils.TransformAnnotationData import love.forte.plugin.suspendtrans.utils.toClassId import love.forte.plugin.suspendtrans.utils.toInfo import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol @@ -14,24 +14,25 @@ import org.jetbrains.kotlin.fir.analysis.checkers.processOverriddenFunctions import org.jetbrains.kotlin.fir.caches.FirCache import org.jetbrains.kotlin.fir.caches.firCachesFactory import org.jetbrains.kotlin.fir.caches.getValue -import org.jetbrains.kotlin.fir.collectUpperBounds -import org.jetbrains.kotlin.fir.copy import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.* +import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality -import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression +import org.jetbrains.kotlin.fir.expressions.buildResolvedArgumentList import org.jetbrains.kotlin.fir.expressions.builder.* +import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.plugin.createConeType +import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope @@ -257,7 +258,7 @@ class SuspendTransformFirTransformer( if (annotations.none { it.fqName(session) == targetMarkerAnnotation.asSingleFqName() && (it.argumentMapping.mapping[targetMarkerValueName] as? FirLiteralExpression) - ?.value == markerId + ?.value == markerId }) { replaceAnnotations( buildList { @@ -335,6 +336,8 @@ class SuspendTransformFirTransformer( ) ) + val funTarget = FirFunctionTarget(null, false) + val newFun = buildSimpleFunctionCopy(originFunc) { name = callableId.callableName symbol = newFunSymbol @@ -363,12 +366,100 @@ class SuspendTransformFirTransformer( annotations.clear() annotations.addAll(functionAnnotations) - body = null val returnType = resolveReturnType(originFunc, funData, returnTypeRef) - returnTypeRef = returnType + body = buildBlock { + this.source = originFunc.body?.source + + // lambda: () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.isLambda = true + this.moduleData = originFunc.moduleData + this.origin = key.origin + this.returnTypeRef = originFunc.returnTypeRef + this.hasExplicitParameterList = false + this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.source = originFunc.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunc.source + this.name = originFunc.name + this.resolvedSymbol = originFunc.symbol + } +// this.argumentList = buildArgumentList { +// for (originParam in originFunc.valueParameters) { +// arguments.add(originParam.toQualifiedAccess()) +// } +// } + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + for (originParam in originFunc.valueParameters) { + put(originParam.toQualifiedAccess(), originParam) + } + } + ) + } + } + ) + } + lambdaTarget.bind(lambda) + + this.statements.add(buildAnonymousFunctionExpression { + this.anonymousFunction = lambda + this.isTrailingLambda = false + }) + +// this.statements.add( +// buildReturnExpression { +// this.target = funTarget +// val transformName = with(funData.transformer.transformFunctionInfo) { +// buildString { +// if (packageName.isNotEmpty()) { +// append(packageName) +// append('.') +// } +// if (className?.isNotEmpty() == true) { +// append(className) +// append('.') +// } +// append(functionName) +// } +// } +// +// holder.session.moduleData.dependencies +// +// this.result = buildFunctionCall { +// this.source = null + // TODO 必须 resolved +// this.calleeReference = buildSimpleNamedReference { +// this.source = null +// this.name = Name.identifier(transformName) +// } + // TODO Argument 必须 resolved +//// this.argumentList = buildArgumentList { +//// arguments.add(buildAnonymousFunctionExpression { +//// this.source = lambda.source +//// this.anonymousFunction = lambda +//// this.isTrailingLambda = false +//// }) +//// // TODO scope? +//// } +// } +// } +// ) + // ConeClassLikeType() + } + // body = null + // TODO 是否可以在FIR中就完成Body的构建? // buildBlock { // // build lambda @@ -429,6 +520,8 @@ class SuspendTransformFirTransformer( origin = key.origin } + funTarget.bind(newFun) + if (targetMarkerAnnotation != null) { originFunc.appendTargetMarker(uniqueFunHash) } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 5f9888f..43bbdae 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -95,15 +95,19 @@ class SuspendTransformTransformer( pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) }, callableFunction - )?.also { generatedOriginFunction -> + ).also { generatedOriginFunction -> if (property != null) { // NO! BACKING! FIELD! property.backingField = null } - postProcessGenerateOriginFunction( - generatedOriginFunction, - pluginKey.data.transformer.originFunctionIncludeAnnotations - ) + + if (generatedOriginFunction != null) { + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } } @@ -162,6 +166,11 @@ class SuspendTransformTransformer( crossinline checkIsOriginFunction: (IrFunction) -> Boolean, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrFunction? { + if (function.body != null) { + return null + } + + val parent = function.parent if (parent is IrDeclarationContainer) { @@ -255,14 +264,12 @@ class SuspendTransformTransformer( originFunction.reportLocation() ?: function.reportLocation() ) - if (function.body == null) { - function.body = generateTransformBodyForFunctionLambda( - pluginContext, - function, - originFunction, - transformTargetFunctionCall - ) - } + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + originFunction, + transformTargetFunctionCall + ) return originFunction } diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index d1eb602..505d025 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -67,4 +67,10 @@ public void testImplOverridenGeneric() { public void testAlias() { runTest("src/testData/codegen/alias.kt"); } + + @Test + @TestMetadata("varargParam.kt") + public void testVarargParam() { + runTest("src/testData/codegen/varargParam.kt"); + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt new file mode 100644 index 0000000..a95caea --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt @@ -0,0 +1,18 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +public interface DeleteOption + +abstract class MyClass { + @JvmBlocking + @JvmAsync + suspend open fun deleteAll(vararg options: DeleteOption): Int { + return 1 + } +} From 6a56d606cb6e25aab9f213430e97f473a1616860 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Wed, 22 Jan 2025 02:07:58 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suspendtrans/SuspendTransformUserData.kt | 5 + .../fir/SuspendTransformFirTransformer.kt | 740 +++++++++++------- .../fir/SuspendTransformPluginKey.kt | 9 +- .../ir/SuspendTransformTransformer.kt | 166 ++-- .../runners/AbstractCodeGenTestRunner.kt | 2 +- .../src/testData/codegen/varargParam.kt | 5 +- local-helper/build.gradle.kts | 59 ++ .../src/commonMain/kotlin/MyInterface.kt | 38 + settings.gradle.kts | 2 + 9 files changed, 688 insertions(+), 338 deletions(-) create mode 100644 local-helper/build.gradle.kts create mode 100644 local-helper/src/commonMain/kotlin/MyInterface.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt index dac40c6..9207100 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt @@ -147,6 +147,11 @@ data class SuspendTransformUserDataFir( val transformer: Transformer ) +data class SuspendTransformBridgeFunDataFir( + val asProperty: Boolean, + val transformer: Transformer +) + fun FirNamedFunctionSymbol.asOriginSymbol( targetMarker: ClassId?, typeParameters: List, diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 9794db5..1e58b28 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -1,11 +1,10 @@ package love.forte.plugin.suspendtrans.fir import love.forte.plugin.suspendtrans.* -import love.forte.plugin.suspendtrans.utils.CopyAnnotationsData -import love.forte.plugin.suspendtrans.utils.TransformAnnotationData -import love.forte.plugin.suspendtrans.utils.toClassId -import love.forte.plugin.suspendtrans.utils.toInfo +import love.forte.plugin.suspendtrans.utils.* +import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext @@ -21,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality +import org.jetbrains.kotlin.fir.deserialization.replaceName import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression @@ -32,9 +32,12 @@ import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.plugin.createConeType +import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference +import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve +import org.jetbrains.kotlin.fir.resolve.transformers.ScopeClassDeclaration import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.scopes.processAllFunctions @@ -43,6 +46,7 @@ import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef +import org.jetbrains.kotlin.fir.types.builder.buildFunctionTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId @@ -56,6 +60,7 @@ import org.jetbrains.kotlin.platform.konan.isNative import org.jetbrains.kotlin.types.ConstantValueKind import java.util.* import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.atomic.AtomicInteger private data class CopiedTypeParameterPair( val original: FirTypeParameter, @@ -78,10 +83,33 @@ class SuspendTransformFirTransformer( val memberScope: FirClassDeclaredMemberScope? ) - private data class FunData( - val annotationData: TransformAnnotationData, - val transformer: Transformer, - ) + private sealed class FunData { + abstract val funName: Name + abstract val transformer: Transformer + abstract val annotationData: TransformAnnotationData + } + + // synthetic fun 需要知道 bridge fun, 反之则不需要 + + private data class SyntheticFunData( + override val funName: Name, + val bridgeFunData: BridgeFunData, + ) : FunData() { + override val annotationData: TransformAnnotationData + get() = bridgeFunData.annotationData + override val transformer: Transformer + get() = bridgeFunData.transformer + } + + private data class BridgeFunData( + override val funName: Name, + val symbol: FirNamedFunctionSymbol, + val target: FirFunctionTarget, + val lambdaParameter: FirValueParameter, + val returnType: FirTypeRef, + override val annotationData: TransformAnnotationData, + override val transformer: Transformer, + ) : FunData() // private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = private val cache: FirCache>?, Nothing?> = @@ -93,9 +121,9 @@ class SuspendTransformFirTransformer( override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>, context: MemberGenerationContext): Set { val names = mutableSetOf() - cache.getValue(FirCacheKey(classSymbol, context.declaredScope))?.forEach { (_, map) -> - map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } +// map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } + map.values.forEach { names.add(it.funName) } } return names @@ -298,239 +326,310 @@ class SuspendTransformFirTransformer( val funList = arrayListOf() funcMap.forEach { (func, funData) -> + when (funData) { + is BridgeFunData -> { + generateBridgeFunctions( + callableId, + context, + owner, + func, + funData, + funList, + ) + } - val annotationData = funData.annotationData - if (!annotationData.asProperty) { - // Check the overridden for isOverride based on source function (func) 's overridden - val isOverride = checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, func, checkContext) + is SyntheticFunData -> { + generateSyntheticFunctions( + callableId, + context, + owner, + func, + funData, + funList, + ) + } + } + } - // generate + return funList + } + + private fun generateBridgeFunctions( + callableId: CallableId, + context: MemberGenerationContext?, + owner: FirClassSymbol<*>, + originFunSymbol: FirNamedFunctionSymbol, + funData: BridgeFunData, + results: MutableList, + ) { + // private inline fun $name(block: suspend () -> T): returnType // IR -> {} + val key = SuspendTransformBridgeFunctionKey( + data = SuspendTransformBridgeFunDataFir( + asProperty = false, + transformer = funData.transformer + ) + ) + + val bridgeFun = buildSimpleFunction { + name = funData.funName + source = originFunSymbol.source + moduleData = originFunSymbol.moduleData + // see FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS + status = FirResolvedDeclarationStatusImpl( + Visibilities.Private, + Modality.FINAL, + EffectiveVisibility.PrivateInClass + ).copy( + visibility = Visibilities.Private, + modality = Modality.FINAL, + isOverride = false, + isSuspend = false, + isInline = true, + ) + returnTypeRef = funData.returnType + receiverParameter = null + containerSource = originFunSymbol.containerSource + dispatchReceiverType = originFunSymbol.dispatchReceiverType + // TODO 泛型需不需要处理? + valueParameters.add(funData.lambdaParameter) + body = null + symbol = funData.symbol + + // TODO 仅保留跟 originFun.returnType 一样或相关的 type parameter? +// val returnConeType = originFunSymbol.resolvedReturnTypeRef.coneType +// originFunSymbol.typeParameterSymbols.find { originTypeParameterSymbol -> +// returnConeType.copyWithTypeParameters() +// originTypeParameterSymbol +// TODO() +// } + + origin = key.origin + } + + bridgeFun.jvmSynthetic(session) + + funData.target.bind(bridgeFun) + + results.add(bridgeFun.symbol) + } + + @OptIn(SymbolInternals::class) + private fun generateSyntheticFunctions( + callableId: CallableId, + context: MemberGenerationContext?, + owner: FirClassSymbol<*>, + originFunSymbol: FirNamedFunctionSymbol, + funData: SyntheticFunData, + results: MutableList, + ) { + val bridgeFunData = funData.bridgeFunData + + val annotationData = funData.annotationData + if (!annotationData.asProperty) { + // Check the overridden for isOverride based on source function (func) 's overridden + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originFunSymbol, checkContext) - val originFunc = func.fir + // generate + val originFunc = originFunSymbol.fir - val uniqueFunHash = originFunc.calculateOriginFuncHash() + val uniqueFunHash = originFunc.calculateOriginFuncHash() - // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 + // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 // val syntheticFunCallableName = callableId.callableName.asString() + "-f-${uniqueFunHash}" // val syntheticFunName = callableId.copy(Name.identifier(syntheticFunCallableName)) // val syntheticFun = originFunc.copySyntheticFun(owner, callableId) // funList.add(syntheticFun.symbol) - val (functionAnnotations, _) = copyAnnotations(originFunc, funData) - - val newFunSymbol = FirNamedFunctionSymbol(callableId) + val (functionAnnotations, _) = copyAnnotations(originFunc, funData) + + val newFunSymbol = FirNamedFunctionSymbol(callableId) + + val key = SuspendTransformPluginKey( + data = SuspendTransformUserDataFir( + markerId = uniqueFunHash, + originSymbol = originFunc.symbol.asOriginSymbol( + targetMarkerAnnotation, + typeParameters = originFunc.typeParameters, + valueParameters = originFunc.valueParameters, + originFunc.returnTypeRef.coneTypeOrNull?.classId, + session, + ), + asProperty = false, + transformer = funData.transformer + ) + ) - val key = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = originFunc.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = originFunc.typeParameters, - valueParameters = originFunc.valueParameters, - originFunc.returnTypeRef.coneTypeOrNull?.classId, - session, - ), - asProperty = false, - transformer = funData.transformer - ) + val newFunTarget = FirFunctionTarget(null, isLambda = false) + val newFun = buildSimpleFunctionCopy(originFunc) { + name = callableId.callableName + symbol = newFunSymbol + status = originFunc.status.copy( + isSuspend = false, + modality = originFunc.syntheticModifier, + // Use OPEN and `override` is unnecessary. .. ... Maybe? + isOverride = isOverride || isOverridable( + session, + callableId.callableName, + originFunc, + owner, + isProperty = false, + ), ) - val funTarget = FirFunctionTarget(null, false) + // Copy the typeParameters. + // Otherwise, in functions like the following, an error will occur + // suspend fun data(value: A): T = ... + // Functions for which function-scoped generalizations (``) exist. + // In the generated IR, data and dataBlocking will share an `A`, generating the error. + // The error: Duplicate IR node + // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] + // TODO copy to value parameters, receiver and + // return type? + copyParameters() - val newFun = buildSimpleFunctionCopy(originFunc) { - name = callableId.callableName - symbol = newFunSymbol - status = originFunc.status.copy( - isSuspend = false, - modality = originFunc.syntheticModifier, - // Use OPEN and `override` is unnecessary. .. ... Maybe? - isOverride = isOverride || isOverridable( - session, - callableId.callableName, - originFunc, - owner, - isProperty = false, - ), - ) + val thisReceiverParameter = this.receiverParameter + val thisContextReceivers = this.contextReceivers + val thisValueParameters = this.valueParameters - // Copy the typeParameters. - // Otherwise, in functions like the following, an error will occur - // suspend fun data(value: A): T = ... - // Functions for which function-scoped generalizations (``) exist. - // In the generated IR, data and dataBlocking will share an `A`, generating the error. - // The error: Duplicate IR node - // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] - // TODO copy to value parameters, receiver and return type? - copyParameters() + annotations.clear() + annotations.addAll(functionAnnotations) - annotations.clear() - annotations.addAll(functionAnnotations) + returnTypeRef = funData.bridgeFunData.returnType - val returnType = resolveReturnType(originFunc, funData, returnTypeRef) - returnTypeRef = returnType + /* + * __suspendTransform__run_0_runBlocking({ run(times) }) + */ + + body = buildBlock { + this.source = originFunc.body?.source + + // lambda: suspend () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.isLambda = true + this.moduleData = originFunSymbol.moduleData +// this.origin = key.origin + this.origin = FirDeclarationOrigin.Synthetic.FakeFunction + this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef + this.hasExplicitParameterList = false + this.status = + FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType + this.source = originFunSymbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunSymbol.source + this.name = originFunSymbol.name + this.resolvedSymbol = originFunSymbol + } - body = buildBlock { - this.source = originFunc.body?.source - - // lambda: () -> T - val lambdaTarget = FirFunctionTarget(null, isLambda = true) - val lambda = buildAnonymousFunction { - this.isLambda = true - this.moduleData = originFunc.moduleData - this.origin = key.origin - this.returnTypeRef = originFunc.returnTypeRef - this.hasExplicitParameterList = false - this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - this.symbol = FirAnonymousFunctionSymbol() - this.body = buildSingleExpressionBlock( - buildReturnExpression { - target = lambdaTarget - result = buildFunctionCall { - // Call original fun - this.source = originFunc.source - this.calleeReference = buildResolvedNamedReference { - this.source = originFunc.source - this.name = originFunc.name - this.resolvedSymbol = originFunc.symbol + val originValueParameters = originFunc.valueParameters + + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner } -// this.argumentList = buildArgumentList { -// for (originParam in originFunc.valueParameters) { -// arguments.add(originParam.toQualifiedAccess()) -// } -// } - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - for (originParam in originFunc.valueParameters) { - put(originParam.toQualifiedAccess(), originParam) - } + } + + // TODO? + this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> + buildThisReceiverExpression { + coneTypeOrNull = receiver.typeRef.coneTypeOrNull + source = receiver.source + calleeReference = buildExplicitThisReference { + source = receiver.source + labelName = receiver.labelName?.asString() } - ) + } + }) + + // TODO? + this.explicitReceiver = thisReceiverParameter?.let { thisExplicitReceiver -> + buildThisReceiverExpression { + coneTypeOrNull = thisExplicitReceiver.typeRef.coneTypeOrNull + source = thisExplicitReceiver.source + calleeReference = buildExplicitThisReference { + source = thisExplicitReceiver.source + } + } } - } - ) - } - lambdaTarget.bind(lambda) - this.statements.add(buildAnonymousFunctionExpression { - this.anonymousFunction = lambda - this.isTrailingLambda = false - }) + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + thisValueParameters.forEachIndexed { index, thisParam -> + val qualifiedAccess = thisParam.toQualifiedAccess() + put(qualifiedAccess, originValueParameters[index]) + } + } + ) + } + } + ) -// this.statements.add( -// buildReturnExpression { -// this.target = funTarget -// val transformName = with(funData.transformer.transformFunctionInfo) { -// buildString { -// if (packageName.isNotEmpty()) { -// append(packageName) -// append('.') -// } -// if (className?.isNotEmpty() == true) { -// append(className) -// append('.') -// } -// append(functionName) -// } -// } -// -// holder.session.moduleData.dependencies -// -// this.result = buildFunctionCall { -// this.source = null - // TODO 必须 resolved -// this.calleeReference = buildSimpleNamedReference { -// this.source = null -// this.name = Name.identifier(transformName) -// } - // TODO Argument 必须 resolved -//// this.argumentList = buildArgumentList { -//// arguments.add(buildAnonymousFunctionExpression { -//// this.source = lambda.source -//// this.anonymousFunction = lambda -//// this.isTrailingLambda = false -//// }) -//// // TODO scope? -//// } -// } -// } -// ) - // ConeClassLikeType() + this.typeRef = bridgeFunData.lambdaParameter.returnTypeRef } - // body = null - - // TODO 是否可以在FIR中就完成Body的构建? -// buildBlock { -// // build lambda -// val lambda = buildAnonymousFunctionExpression { -// anonymousFunction = buildAnonymousFunction { -// moduleData = originFunc.moduleData -// origin = key.origin -// status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION -// returnTypeRef = originFunc.returnTypeRef -// isLambda = true -// body = buildSingleExpressionBlock( -// buildReturnExpression { -// result = buildFunctionCall { -//// explicitReceiver = this@createConventionCall -// calleeReference = buildResolvedNamedReference { -// source = originFunc.source -// name = originFunc.name -// resolvedSymbol = originFunc.symbol -// } -// -// argumentList = buildResolvedArgumentList(null, -// this@buildSimpleFunctionCopy.valueParameters.associateByTo(LinkedHashMap()) { valueParameter -> -// buildCallableReferenceAccess { -// source = valueParameter.source -// calleeReference = buildResolvedNamedReference { -// source = valueParameter.source -// name = valueParameter.name -// resolvedSymbol = valueParameter.symbol -// } -// coneTypeOrNull = valueParameter.returnTypeRef.coneTypeOrNull -// } -// } -// ) -// } -// } -// ) -// symbol = FirAnonymousFunctionSymbol() -// } -// } -// lambda -// -// -// /* -// fun xxxBlock() = transformFun({ orignFun }, ) -// */ -// statements.add( -// buildReturnExpression { -// -// -// } -// ) -// -// buildFunctionCall { -// this -// } -// } - - origin = key.origin - } + lambdaTarget.bind(lambda) + + // bind to bridge fun + + this.statements.add( + buildReturnExpression { + this.target = newFunTarget + this.result = buildFunctionCall { + this.coneTypeOrNull = bridgeFunData.returnType.coneType + this.source = bridgeFunData.symbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = bridgeFunData.symbol.source + this.name = bridgeFunData.symbol.name + this.resolvedSymbol = bridgeFunData.symbol + } - funTarget.bind(newFun) + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + } - if (targetMarkerAnnotation != null) { - originFunc.appendTargetMarker(uniqueFunHash) + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put(buildAnonymousFunctionExpression { + source = null + anonymousFunction = lambda + isTrailingLambda = false + }, funData.bridgeFunData.lambdaParameter) + } + ) + } + } + ) } + // body = null - funList.add(newFun.symbol) + origin = key.origin } - } - return funList + if (targetMarkerAnnotation != null) { + originFunc.appendTargetMarker(uniqueFunHash) + } + + // TODO 在原函数上附加的annotations + + newFunTarget.bind(newFun) + results.add(newFun.symbol) + } } @OptIn(SymbolInternals::class) @@ -545,44 +644,49 @@ class SuspendTransformFirTransformer( val propList = mutableListOf() - funcMap.forEach { (func, funData) -> + for ((originalFunSymbol, funData) in funcMap) { + if (funData !is SyntheticFunData) { + continue + } + val annotationData = funData.annotationData if (annotationData.asProperty) { - val isOverride = checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, func, checkContext) + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) // generate - val original = func.fir + val original = originalFunSymbol.fir val uniqueFunHash = original.calculateOriginFuncHash() val (functionAnnotations, propertyAnnotations) = copyAnnotations(original, funData) -// val p = createMemberProperty() -// owner = owner, -// key = SuspendTransformPluginKey( -// data = SuspendTransformUserDataFir( -// originSymbol = original.symbol.asOriginSymbol( -// typeParameters = original.typeParameters, -// valueParameters = original.valueParameters, -// original.returnTypeRef.coneTypeOrNull?.classId -// ), -// asProperty = true, -// transformer = funData.transformer -// ) -// ), -// name = callableId.callableName, -// returnTypeProvider = { resolveReturnConeType(original, funData) }, -// isVal = true, -// hasBackingField = false, -// ) { -// modality = original.syntheticModifier ?: Modality.FINAL -// // TODO receiver? -//// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull -//// if (receiverType != null) { -//// extensionReceiverType(receiverType) -//// } -// } + // val p = createMemberProperty() + // owner = owner, + // key = SuspendTransformPluginKey( + // data = SuspendTransformUserDataFir( + // originSymbol = original.symbol.asOriginSymbol( + // typeParameters = original.typeParameters, + // valueParameters = original.valueParameters, + // original.returnTypeRef.coneTypeOrNull?.classId + // ), + // asProperty = true, + // transformer = funData.transformer + // ) + // ), + // name = callableId.callableName, + // returnTypeProvider = { resolveReturnConeType(original, funData) }, + // isVal = true, + // hasBackingField = false, + // ) { + // modality = original.syntheticModifier ?: Modality.FINAL + // // TODO receiver? + //// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull + //// if (receiverType != null) { + //// extensionReceiverType(receiverType) + //// } + // } val pSymbol = FirPropertySymbol(callableId) val pKey = SuspendTransformPluginKey( @@ -601,7 +705,7 @@ class SuspendTransformFirTransformer( ) - val returnType = resolveReturnType(original, funData, original.returnTypeRef) + val returnType = resolveReturnType(funData.transformer, original.returnTypeRef) val p1 = buildProperty { symbol = pSymbol @@ -615,7 +719,7 @@ class SuspendTransformFirTransformer( isSuspend = false, isFun = false, isInner = false, -// modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, + // modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, modality = original.syntheticModifier, isOverride = isOverride || isOverridable( session, @@ -654,23 +758,23 @@ class SuspendTransformFirTransformer( origin = pKey.origin -// attributes = original.attributes.copy() + // attributes = original.attributes.copy() status = original.status.copy( isSuspend = false, isFun = false, isInner = false, modality = original.syntheticModifier, isOverride = false, // funData.isOverride, -// visibility = this@buildProperty.status + // visibility = this@buildProperty.status ) returnTypeRef = original.returnTypeRef -// deprecationsProvider = original.deprecationsProvider -// containerSource = original.containerSource -// dispatchReceiverType = original.dispatchReceiverType -// contextReceivers.addAll(original.contextReceivers) + // deprecationsProvider = original.deprecationsProvider + // containerSource = original.containerSource + // dispatchReceiverType = original.dispatchReceiverType + // contextReceivers.addAll(original.contextReceivers) valueParameters.addAll(original.valueParameters) -// body = null -// contractDescription = original.contractDescription + // body = null + // contractDescription = original.contractDescription typeParameters.addAll(original.typeParameters) } } @@ -680,6 +784,8 @@ class SuspendTransformFirTransformer( if (targetMarkerAnnotation != null) { original.appendTargetMarker(uniqueFunHash) } + + // TODO 在原函数上附加的annotations } } @@ -687,14 +793,14 @@ class SuspendTransformFirTransformer( } private fun checkSyntheticFunctionIsOverrideBasedOnSourceFunction( - funData: FunData, + syntheticFunData: SyntheticFunData, func: FirNamedFunctionSymbol, checkContext: CheckerContext ): Boolean { // Check the overridden for isOverride based on source function (func) 's overridden var isOverride = false - val annoData = funData.annotationData - val markAnnotation = funData.transformer.markAnnotation + val annoData = syntheticFunData.annotationData + val markAnnotation = syntheticFunData.transformer.markAnnotation if (func.isOverride && !isOverride) { func.processOverriddenFunctions( @@ -791,6 +897,23 @@ class SuspendTransformFirTransformer( } } + // TODO + // https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin/issues/75 + // 原始函数生成两个函数: + // 1. xxxBlocking 真正要生成的函数 + // 2. __suspendTransform__$funName_$index_$transFunName 用于提供给 IR 直接生成body的private桥接函数 + + // fun.name -> Counter + val funNameCounters = mutableMapOf() + + fun resolveFunNameCount(name: String): Int = funNameCounters.computeIfAbsent(name) { + AtomicInteger(0) + }.andIncrement + + // Key -> synthetic fun name or bridge fun name + // Value Map -> + // Key: -> origin fun symbol + // Values -> FunData val map = ConcurrentHashMap>() declaredScope.processAllFunctions { func -> @@ -811,12 +934,80 @@ class SuspendTransformFirTransformer( // 必须使用 anno.getXxxArgument(Name(argument name)), // 使用 argumentMapping.mapping 获取不到结果 // println("RAW AnnoData: ${anno.argumentMapping.mapping}") - val annoData = anno.toTransformAnnotationData(markAnnotation, functionName) - val syntheticFunName = Name.identifier(annoData.functionName) - map.computeIfAbsent(syntheticFunName) { ConcurrentHashMap() }[func] = - FunData(annoData, transformer) + val funCount = resolveFunNameCount(functionName) + + val syntheticFunNameString = annoData.functionName + val bridgeFunNameString = bridgeFunName(functionName, funCount, syntheticFunNameString) + + val syntheticFunName = Name.identifier(syntheticFunNameString) + val bridgeFunName = Name.identifier(bridgeFunNameString) + + val bridgeFunCallableId = func.callableId.replaceName(bridgeFunName) + + val bridgeFunSymbol = FirNamedFunctionSymbol(bridgeFunCallableId) + + // noinline suspend () -> T + val suspendLambdaValueParameter = buildValueParameter { + source = func.source + resolvePhase = FirResolvePhase.RAW_FIR + moduleData = func.moduleData + origin = FirDeclarationOrigin.Synthetic.FakeFunction + + returnTypeRef = buildResolvedTypeRef { + source = func.source + val funTypeRef = buildFunctionTypeRef { + source = func.source + isMarkedNullable = false + receiverTypeRef = null + isSuspend = true + returnTypeRef = func.resolvedReturnTypeRef + } + + delegatedTypeRef = funTypeRef + + coneType = session.typeResolver.resolveType( + funTypeRef, + ScopeClassDeclaration(emptyList(), emptyList()), + false, + false, + false, + null, + SupertypeSupplier.Default, + ).type + } + + backingField = null + defaultValue = null + val pname = Name.identifier("block") + name = pname + symbol = FirValueParameterSymbol(pname) + containingFunctionSymbol = bridgeFunSymbol + isVararg = false + isCrossinline = false + isNoinline = true + } + + val returnType = resolveReturnType(transformer, func.resolvedReturnTypeRef) + + val bridgeFunData = BridgeFunData( + bridgeFunName, + bridgeFunSymbol, + FirFunctionTarget(null, false), + suspendLambdaValueParameter, + returnType, + annoData, + transformer + ) + + map.computeIfAbsent(bridgeFunName) { name -> + ConcurrentHashMap() + }[func] = bridgeFunData + + map.computeIfAbsent(syntheticFunName) { + ConcurrentHashMap() + }[func] = SyntheticFunData(syntheticFunName, bridgeFunData) } } } @@ -824,6 +1015,11 @@ class SuspendTransformFirTransformer( return map } + private fun bridgeFunName(original: String, count: Int, syntheticFun: String): String { + // __suspendTransform__run_0_runBlocking + return "__suspendTransform__${original}_${count}_${syntheticFun}" + } + private fun FirAnnotation.toTransformAnnotationData( markAnnotation: MarkAnnotation, sourceFunctionName: String @@ -852,11 +1048,10 @@ class SuspendTransformFirTransformer( )?.firstOrNull() private fun resolveReturnType( - original: FirSimpleFunction, - funData: FunData, + transformer: Transformer, returnTypeRef: FirTypeRef ): FirTypeRef { - val resultConeType = resolveReturnConeType(original, funData, returnTypeRef) + val resultConeType = resolveReturnConeType(transformer, returnTypeRef) return if (resultConeType is ConeErrorType) { buildErrorTypeRef { @@ -871,11 +1066,10 @@ class SuspendTransformFirTransformer( } private fun resolveReturnConeType( - original: FirSimpleFunction, - funData: FunData, + transformer: Transformer, returnTypeRef: FirTypeRef ): ConeKotlinType { - val transformer = funData.transformer + val transformer = transformer val returnType = transformer.transformReturnType ?: return returnTypeRef.coneType // OrNull // original.symbol.resolvedReturnType @@ -898,9 +1092,9 @@ class SuspendTransformFirTransformer( * @return function annotations `to` property annotations. */ private fun copyAnnotations( - original: FirSimpleFunction, funData: FunData, + original: FirSimpleFunction, syntheticFunData: SyntheticFunData, ): Pair, List> { - val transformer = funData.transformer + val transformer = syntheticFunData.transformer val (copyFunction, copyProperty, excludes, includes) = CopyAnnotationsData( transformer.copyAnnotationsToSyntheticFunction, @@ -941,22 +1135,6 @@ class SuspendTransformFirTransformer( addAll(copied) } - // try add @Generated(by = ...) -// runCatching { -// val generatedAnnotation = buildAnnotation { -// annotationTypeRef = buildResolvedTypeRef { -// type = generatedAnnotationClassId.createConeType(session) -// } -// argumentMapping = buildAnnotationArgumentMapping { -// includeGeneratedArguments(original) -// } -// } -// add(generatedAnnotation) -// }.getOrElse { e -> -// // Where is log? -// e.printStackTrace() -// } - // add includes includes.forEach { include -> val classId = include.classId diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt index 33a708f..cc53c85 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt @@ -1,10 +1,17 @@ package love.forte.plugin.suspendtrans.fir +import love.forte.plugin.suspendtrans.SuspendTransformBridgeFunDataFir import love.forte.plugin.suspendtrans.SuspendTransformUserDataFir import org.jetbrains.kotlin.GeneratedDeclarationKey -data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : GeneratedDeclarationKey() { +sealed class SuspendTransformGeneratedDeclarationKey() : GeneratedDeclarationKey() + +data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : + SuspendTransformGeneratedDeclarationKey() { override fun toString(): String { return "SuspendTransformPlugin(data=$data)" } } + +data class SuspendTransformBridgeFunctionKey(val data: SuspendTransformBridgeFunDataFir) : + SuspendTransformGeneratedDeclarationKey() diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 43bbdae..a9646d4 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -1,6 +1,8 @@ package love.forte.plugin.suspendtrans.ir import love.forte.plugin.suspendtrans.* +import love.forte.plugin.suspendtrans.fir.SuspendTransformBridgeFunctionKey +import love.forte.plugin.suspendtrans.fir.SuspendTransformGeneratedDeclarationKey import love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext @@ -15,10 +17,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrBody -import org.jetbrains.kotlin.ir.expressions.IrCall -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.IrTypeOperator +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol @@ -72,10 +71,10 @@ class SuspendTransformTransformer( val pluginKey = if (property != null) { // from property (property.origin as? IrDeclarationOrigin.GeneratedByPlugin) - ?.pluginKey as? SuspendTransformPluginKey + ?.pluginKey as? SuspendTransformGeneratedDeclarationKey } else { (declaration.origin as? IrDeclarationOrigin.GeneratedByPlugin) - ?.pluginKey as? SuspendTransformPluginKey + ?.pluginKey as? SuspendTransformGeneratedDeclarationKey } // K1 ? @@ -83,32 +82,66 @@ class SuspendTransformTransformer( val generatedOriginFunction: IrFunction? = when { pluginKey != null -> { - val callableFunction = - pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) - .firstOrNull() - ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") - resolveFunctionBody( - pluginKey, - declaration, - { f -> - pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) - }, - callableFunction - ).also { generatedOriginFunction -> - if (property != null) { - // NO! BACKING! FIELD! - property.backingField = null - } - - if (generatedOriginFunction != null) { - postProcessGenerateOriginFunction( - generatedOriginFunction, - pluginKey.data.transformer.originFunctionIncludeAnnotations + when (pluginKey) { + is SuspendTransformBridgeFunctionKey -> { + val callableFunction = + pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") + + resolveBridgeFunctionBody( + pluginKey, + declaration, + callableFunction ) + + null +// .also { generatedOriginFunction -> +// if (property != null) { +// // NO! BACKING! FIELD! +// property.backingField = null +// } +// +// if (generatedOriginFunction != null) { +// postProcessGenerateOriginFunction( +// generatedOriginFunction, +// pluginKey.data.transformer.originFunctionIncludeAnnotations +// ) +// } +// } } + is SuspendTransformPluginKey -> { + val callableFunction = + pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") + + resolveFunctionBody( + pluginKey, + declaration, + { f -> + pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) + }, + callableFunction + ).also { generatedOriginFunction -> + if (property != null) { + // NO! BACKING! FIELD! + property.backingField = null + } + + if (generatedOriginFunction != null) { + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } + } } + + } userData != null -> { @@ -159,6 +192,9 @@ class SuspendTransformTransformer( } } + /** + * @return origin function + */ @OptIn(ObsoleteDescriptorBasedAPI::class) private inline fun resolveFunctionBody( sourceKey: Any?, @@ -274,10 +310,25 @@ class SuspendTransformTransformer( return originFunction } - - return null } + + /** + * 直接为bridge fun生成body + */ + private fun resolveBridgeFunctionBody( + sourceKey: Any?, + function: IrFunction, + transformTargetFunctionCall: IrSimpleFunctionSymbol, + ) { + // body: return $transform(block, scope?) + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + null, + transformTargetFunctionCall + ) + } } private fun IrFunction.reportLocation(): CompilerMessageSourceLocation? { @@ -353,45 +404,54 @@ private fun generateTransformBodyForFunction( private fun generateTransformBodyForFunctionLambda( context: IrPluginContext, function: IrFunction, - originFunction: IrFunction, + originFunction: IrFunction?, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrBody { - val originValueParameters = originFunction.valueParameters - function.valueParameters.forEachIndexed { index, parameter -> - val originFunctionValueParameter = originValueParameters[index] - parameter.defaultValue = originFunctionValueParameter.defaultValue + // 不为null,说明是直接生成。否则是bridge + originFunction?.valueParameters?.also { originValueParameters -> + function.valueParameters.forEachIndexed { index, parameter -> + val originFunctionValueParameter = originValueParameters[index] + parameter.defaultValue = originFunctionValueParameter.defaultValue + } } return context.createIrBuilder(function.symbol).irBlockBody { - val suspendLambdaFunc = context.createSuspendLambdaFunctionWithCoroutineScope( - originFunction = originFunction, - function = function - ) - val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) + val lambdaExpression: IrExpression = if (originFunction != null) { + val suspendLambdaFunc = context.createSuspendLambdaFunctionWithCoroutineScope( + originFunction = originFunction, + function = function + ) - +irReturn(irCall(transformTargetFunctionCall).apply { - putValueArgument( - 0, - IrFunctionExpressionImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - lambdaType, - suspendLambdaFunc, - IrStatementOrigin.LAMBDA - ) + val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) + + IrFunctionExpressionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + lambdaType, + suspendLambdaFunc, + IrStatementOrigin.LAMBDA ) - // argument: 1, if is CoroutineScope, and this is CoroutineScope. - val owner = transformTargetFunctionCall.owner + } else { + // is bridge fun, use the first param `block` + val blockParameter = function.valueParameters.first() + irGet(blockParameter) + } + + +irReturn(irCall(transformTargetFunctionCall).apply { + putValueArgument(0, lambdaExpression) + + val transformFunctionOwner = transformTargetFunctionCall.owner // CoroutineScope - val ownerValueParameters = owner.valueParameters + val ownerValueParameters = transformFunctionOwner.valueParameters + // argument: 1, if is CoroutineScope, and this is CoroutineScope. if (ownerValueParameters.size > 1) { for (index in 1..ownerValueParameters.lastIndex) { val valueParameter = ownerValueParameters[index] val type = valueParameter.type - tryResolveCoroutineScopeValueParameter(type, context, function, owner, this@irBlockBody, index) + tryResolveCoroutineScopeValueParameter(type, context, function, transformFunctionOwner, this@irBlockBody, index) } } diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt index 28748a7..2f441de 100644 --- a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt @@ -26,7 +26,7 @@ abstract class AbstractCodeGenTestRunner : AbstractTestRunner() { } configureJvmArtifactsHandlersStep { - useHandlers(::BytecodeListingHandler,::AsmLikeInstructionListingHandler, ) + useHandlers(::BytecodeListingHandler, ::AsmLikeInstructionListingHandler) } defaultDirectives { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt index a95caea..35c8c67 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt @@ -7,12 +7,13 @@ import kotlinx.coroutines.runBlocking import love.forte.plugin.suspendtrans.annotation.JvmAsync import love.forte.plugin.suspendtrans.annotation.JvmBlocking -public interface DeleteOption abstract class MyClass { @JvmBlocking @JvmAsync - suspend open fun deleteAll(vararg options: DeleteOption): Int { + suspend open fun deleteAll(option: Int): Int { return 1 } + } + diff --git a/local-helper/build.gradle.kts b/local-helper/build.gradle.kts new file mode 100644 index 0000000..a453725 --- /dev/null +++ b/local-helper/build.gradle.kts @@ -0,0 +1,59 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + `java-library` + kotlin("multiplatform") +// id("love.forte.plugin.suspend-transform") + // id("suspend-transform.jvm-maven-publish") + // id(project(":suspend-transform-plugin-gradle")) +} + +repositories { + mavenCentral() +} + +kotlin { + jvmToolchain(8) + + jvm { + compilerOptions { + freeCompilerArgs.add("-Xjvm-default=all") + jvmTarget = JvmTarget.JVM_1_8 + } + + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + } + + js { + nodejs() + compilerOptions { + useEsModules() + // https://kotlinlang.org/docs/js-ir-compiler.html#output-mode + freeCompilerArgs.add("-Xir-per-file") + } + generateTypeScriptDefinitions() + binaries.library() + } + + macosX64() + linuxX64() + mingwX64() + + sourceSets { + commonMain { + dependencies { +// api(kotlin("reflect")) + api(libs.kotlinx.coroutines.core) + } + } + + jvmTest { + dependencies { + api(kotlin("test-junit5")) + } + } + } +} + diff --git a/local-helper/src/commonMain/kotlin/MyInterface.kt b/local-helper/src/commonMain/kotlin/MyInterface.kt new file mode 100644 index 0000000..0c24398 --- /dev/null +++ b/local-helper/src/commonMain/kotlin/MyInterface.kt @@ -0,0 +1,38 @@ +import kotlinx.coroutines.CoroutineScope +import kotlin.js.ExperimentalJsExport +import kotlin.js.JsExport + +/** + * + * @author ForteScarlet + */ +@JsExport +interface MyInterface { + + @JsExport.Ignore + suspend fun run(times: Int): Int + + @Suppress("NOTHING_TO_INLINE") + private inline fun __suspendTransform__run_0_runBlocking(noinline block: suspend () -> Int): Int { + return runBlocking(block, this as? CoroutineScope) + } + + fun runBlocking(times: Int): Int = __suspendTransform__run_0_runBlocking({ run(times) }) +} + +@JsExport +@OptIn(ExperimentalJsExport::class) +interface MyInterface2 : MyInterface { + @JsExport.Ignore + suspend fun run2(times: T): T + + @Suppress("NOTHING_TO_INLINE") + private inline fun __suspendTransform__run2_0_runBlocking(noinline block: suspend () -> T): T { + return runBlocking(block, this as? CoroutineScope) + } + + fun run2Blocking(value: T): T = __suspendTransform__run2_0_runBlocking({ run2(value) }) + +} + +fun runBlocking(block: suspend () -> T, scope: CoroutineScope?): T = TODO() diff --git a/settings.gradle.kts b/settings.gradle.kts index 8b9d276..717fd1b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,6 +27,8 @@ include(":runtime:suspend-transform-runtime") include(":plugins:suspend-transform-plugin-gradle") +include(":local-helper") + //Samples // include(":tests:test-jvm") // include(":tests:test-js") From 35c0f89181e251175b6bc5e94f11976e1de8fc9a Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 00:44:24 +0800 Subject: [PATCH 04/11] Refactoring K2 code generation logic --- buildSrc/src/main/kotlin/IProject.kt | 2 +- .../SuspendTransformConfiguration.kt | 6 +- .../fir/SuspendTransformFirTransformer.kt | 1305 ++++++++--------- .../fir/SuspendTransformPluginKey.kt | 5 + .../ir/SuspendTransformTransformer.kt | 25 +- .../plugin/suspendtrans/utils/FirUtils.kt | 69 +- .../runners/CodeGenTestRunnerGenerated.java | 6 + ...spendTransformerEnvironmentConfigurator.kt | 22 +- .../src/testData/codegen/alias.fir.ir.txt | 19 +- .../src/testData/codegen/alias.fir.txt | 16 +- .../testData/codegen/asProperty.fir.ir.txt | 81 +- .../src/testData/codegen/asProperty.fir.txt | 48 +- .../src/testData/codegen/basic.fir.ir.txt | 55 +- .../src/testData/codegen/basic.fir.txt | 45 +- .../testData/codegen/implOverriden.fir.ir.txt | 103 +- .../testData/codegen/implOverriden.fir.txt | 99 +- .../codegen/implOverridenGeneric.fir.ir.txt | 162 +- .../codegen/implOverridenGeneric.fir.txt | 162 +- .../src/testData/codegen/opt.fir.ir.txt | 19 +- .../src/testData/codegen/opt.fir.txt | 16 +- .../src/testData/codegen/override.fir.ir.txt | 38 +- .../src/testData/codegen/override.fir.txt | 32 +- .../src/testData/codegen/typeAttr.fir.ir.txt | 40 +- .../src/testData/codegen/typeAttr.fir.txt | 32 +- .../testData/codegen/typeAttrNested.asm.txt | 35 + .../codegen/typeAttrNested.fir.ir.txt | 77 + .../testData/codegen/typeAttrNested.fir.txt | 18 + .../src/testData/codegen/typeAttrNested.kt | 17 + .../src/testData/codegen/varargParam.asm.txt | 47 + .../testData/codegen/varargParam.fir.ir.txt | 64 + .../src/testData/codegen/varargParam.fir.txt | 25 + .../src/testData_2/codegen/alias.asm.txt | 49 + .../src/testData_2/codegen/alias.fir.ir.txt | 64 + .../src/testData_2/codegen/alias.fir.txt | 16 + .../src/testData_2/codegen/alias.kt | 16 + .../src/testData_2/codegen/asProperty.asm.txt | 141 ++ .../testData_2/codegen/asProperty.fir.ir.txt | 199 +++ .../src/testData_2/codegen/asProperty.fir.txt | 43 + .../src/testData_2/codegen/asProperty.kt | 27 + .../src/testData_2/codegen/basic.asm.txt | 125 ++ .../src/testData_2/codegen/basic.fir.ir.txt | 192 +++ .../src/testData_2/codegen/basic.fir.txt | 49 + .../src/testData_2/codegen/basic.kt | 30 + .../testData_2/codegen/implOverriden.asm.txt | 297 ++++ .../codegen/implOverriden.fir.ir.txt | 480 ++++++ .../testData_2/codegen/implOverriden.fir.txt | 127 ++ .../src/testData_2/codegen/implOverriden.kt | 74 + .../codegen/implOverridenGeneric.asm.txt | 449 ++++++ .../codegen/implOverridenGeneric.fir.ir.txt | 669 +++++++++ .../codegen/implOverridenGeneric.fir.txt | 145 ++ .../codegen/implOverridenGeneric.kt | 83 ++ .../src/testData_2/codegen/opt.asm.txt | 53 + .../src/testData_2/codegen/opt.fir.ir.txt | 122 ++ .../src/testData_2/codegen/opt.fir.txt | 34 + .../src/testData_2/codegen/opt.kt | 27 + .../src/testData_2/codegen/override.asm.txt | 131 ++ .../testData_2/codegen/override.fir.ir.txt | 238 +++ .../src/testData_2/codegen/override.fir.txt | 53 + .../src/testData_2/codegen/override.kt | 29 + .../src/testData_2/codegen/typeAttr.asm.txt | 121 ++ .../testData_2/codegen/typeAttr.fir.ir.txt | 218 +++ .../src/testData_2/codegen/typeAttr.fir.txt | 47 + .../src/testData_2/codegen/typeAttr.kt | 32 + .../testData_2/codegen/typeAttrNested.asm.txt | 35 + .../codegen/typeAttrNested.fir.ir.txt | 77 + .../testData_2/codegen/typeAttrNested.fir.txt | 18 + .../src/testData_2/codegen/typeAttrNested.kt | 17 + .../testData_2/codegen/varargParam.asm.txt | 47 + .../testData_2/codegen/varargParam.fir.ir.txt | 64 + .../testData_2/codegen/varargParam.fir.txt | 25 + .../src/testData_2/codegen/varargParam.kt | 19 + tests/test-js/build.gradle.kts | 19 +- ...ropertyTests.kt => AsPropertyInterface.kt} | 0 tests/test-js/src/jsMain/kotlin/Main.kt | 9 +- .../src/jsTest/kotlin/AsPropertyTest.kt | 21 + .../test-js/src/jsTest/kotlin/PromiseTest.kt | 21 + tests/test-jvm/build.gradle.kts | 2 +- .../suspendtrans/sample/AcceptSupport.kt | 44 + .../suspendtrans/sample/ApiExecutable.kt | 3 + .../src/test/kotlin/SuspendTransformTests.kt | 34 +- 80 files changed, 6348 insertions(+), 1177 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt rename tests/test-js/src/jsMain/kotlin/{AsPropertyTests.kt => AsPropertyInterface.kt} (100%) create mode 100644 tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt create mode 100644 tests/test-js/src/jsTest/kotlin/PromiseTest.kt create mode 100644 tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index c8441de..bb76690 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -11,7 +11,7 @@ object IProject : ProjectDetail() { // Remember the libs.versions.toml! val ktVersion = "2.1.0" - val pluginVersion = "0.10.1" + val pluginVersion = "0.11.0" override val version: String = "$ktVersion-$pluginVersion" diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt index 82d4563..e5b46af 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt @@ -5,7 +5,8 @@ import kotlinx.serialization.Serializable @Serializable data class FunctionInfo( var packageName: String, - var className: String?, + @Deprecated("Top-Level function supported only") + var className: String? = null, var functionName: String, ) @@ -162,8 +163,11 @@ open class SuspendTransformConfiguration { /** * 在 K2 中,用于使 IR 的合成函数可以定位到 FIR 中原始函数的辅助注解。 * + * 昙花一现,在 `*-0.11.0` 之后不再需要此类过渡用注解。 + * * @since *-0.10.0 */ + @Deprecated("Unused after *-0.11.0") open var targetMarker: ClassInfo? = targetMarkerClassInfo open fun clear() { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 1e58b28..1b5665c 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -2,9 +2,7 @@ package love.forte.plugin.suspendtrans.fir import love.forte.plugin.suspendtrans.* import love.forte.plugin.suspendtrans.utils.* -import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext @@ -20,11 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality -import org.jetbrains.kotlin.fir.deserialization.replaceName -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression -import org.jetbrains.kotlin.fir.expressions.buildResolvedArgumentList +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension @@ -35,9 +29,12 @@ import org.jetbrains.kotlin.fir.plugin.createConeType import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.* +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl +import org.jetbrains.kotlin.fir.resolve.getSuperTypes +import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider +import org.jetbrains.kotlin.fir.resolve.toRegularClassSymbol import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve -import org.jetbrains.kotlin.fir.resolve.transformers.ScopeClassDeclaration import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.scopes.processAllFunctions @@ -46,27 +43,27 @@ import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef -import org.jetbrains.kotlin.fir.types.builder.buildFunctionTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef -import org.jetbrains.kotlin.name.CallableId -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.name.* import org.jetbrains.kotlin.platform.isCommon import org.jetbrains.kotlin.platform.isJs import org.jetbrains.kotlin.platform.isWasm import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.platform.konan.isNative -import org.jetbrains.kotlin.types.ConstantValueKind -import java.util.* +import org.jetbrains.kotlin.utils.keysToMap import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.atomic.AtomicInteger private data class CopiedTypeParameterPair( val original: FirTypeParameter, val copied: FirTypeParameter ) +private data class CopyAnnotations( + val functionAnnotations: List, + val propertyAnnotations: List, + val toOriginalAnnotations: List +) + /** * * @author ForteScarlet @@ -75,45 +72,76 @@ class SuspendTransformFirTransformer( session: FirSession, private val suspendTransformConfiguration: SuspendTransformConfiguration ) : FirDeclarationGenerationExtension(session) { - private val targetMarkerValueName = Name.identifier("value") - private val targetMarkerAnnotation = suspendTransformConfiguration.targetMarker?.toClassId() + + private val transformerFunctionSymbolMap = ConcurrentHashMap() + + private lateinit var coroutineScopeSymbol: FirClassLikeSymbol<*> private data class FirCacheKey( val classSymbol: FirClassSymbol<*>, val memberScope: FirClassDeclaredMemberScope? ) - private sealed class FunData { - abstract val funName: Name - abstract val transformer: Transformer - abstract val annotationData: TransformAnnotationData + private data class SyntheticFunData( + val funName: Name, + val annotationData: TransformAnnotationData, + val transformer: Transformer, + val transformerFunctionSymbol: FirNamedFunctionSymbol, + ) + + private fun initScopeSymbol() { + coroutineScopeSymbol = session.symbolProvider.getClassLikeSymbolByClassId( + ClassId( + FqName.fromSegments(listOf("kotlinx", "coroutines")), + Name.identifier("CoroutineScope") + ) + ) ?: error("Cannot resolve `kotlinx.coroutines.CoroutineScope` symbol.") } - // synthetic fun 需要知道 bridge fun, 反之则不需要 + private fun initTransformerFunctionSymbolMap() { + // 尝试找到所有配置的 bridge function, 例如 `runBlocking` 等 + suspendTransformConfiguration.transformers + .forEach { (_, transformerList) -> + for (transformer in transformerList) { + val transformFunctionInfo = transformer.transformFunctionInfo + val packageName = transformFunctionInfo.packageName + val functionName = transformFunctionInfo.functionName + @Suppress("DEPRECATION") + val className = transformFunctionInfo.className + if (className != null) { + error( + "Not support `className` (`$className`) in transformer function info: " + + "top level function supported only." + ) + } - private data class SyntheticFunData( - override val funName: Name, - val bridgeFunData: BridgeFunData, - ) : FunData() { - override val annotationData: TransformAnnotationData - get() = bridgeFunData.annotationData - override val transformer: Transformer - get() = bridgeFunData.transformer - } + // TODO 校验funcs? - private data class BridgeFunData( - override val funName: Name, - val symbol: FirNamedFunctionSymbol, - val target: FirFunctionTarget, - val lambdaParameter: FirValueParameter, - val returnType: FirTypeRef, - override val annotationData: TransformAnnotationData, - override val transformer: Transformer, - ) : FunData() + val transformerFunctionSymbols = + session.symbolProvider.getTopLevelFunctionSymbols( + packageName.fqn, + Name.identifier(functionName) + ) + + if (transformerFunctionSymbols.isNotEmpty()) { + if (transformerFunctionSymbols.size == 1) { + transformerFunctionSymbolMap[transformer] = transformerFunctionSymbols.first() + } else { + error("Found multiple transformer function symbols for transformer: $transformer") + } + } else { + error("Cannot find transformer function symbol for transformer: $transformer") + } + } + } + } // private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = - private val cache: FirCache>?, Nothing?> = + private val cache: FirCache>?, Nothing?> = session.firCachesFactory.createCache { (symbol, scope), c -> + initScopeSymbol() + initTransformerFunctionSymbolMap() + createCache(symbol, scope) } @@ -122,7 +150,6 @@ class SuspendTransformFirTransformer( val names = mutableSetOf() cache.getValue(FirCacheKey(classSymbol, context.declaredScope))?.forEach { (_, map) -> -// map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } map.values.forEach { names.add(it.funName) } } @@ -135,29 +162,12 @@ class SuspendTransformFirTransformer( holder, ReturnTypeCalculatorForFullBodyResolve.Default, ) - private val expectActualContext = session.expectActualMatchingContextFactory.create(session, scope) - - /** - * 根据函数的名称、参数列表的各参数的类型计算一个hash字符串。 - */ - private fun FirSimpleFunction.calculateOriginFuncHash(): String { - val str = buildString { - append(name.asString()) - append(dispatchReceiverType.toString()) - append(receiverParameter?.typeRef?.coneTypeOrNull.toString()) - valueParameters.forEach { vp -> - append(vp.returnTypeRef.coneTypeOrNull.toString()) - } - } - - return Base64.getEncoder().encodeToString(str.toByteArray()) - } - private fun FirSimpleFunctionBuilder.copyParameters() { - val funSymbol = symbol - val originalTypeParameterCache = mutableListOf() - - val newTypeParameters = typeParameters.map { + private fun List.mapToNewTypeParameters( + funSymbol: FirBasedSymbol<*>, + originalTypeParameterCache: MutableList + ): List { + return map { buildTypeParameterCopy(it) { containingDeclarationSymbol = funSymbol // it.containingDeclarationSymbol // symbol = it.symbol // FirTypeParameterSymbol() @@ -166,10 +176,12 @@ class SuspendTransformFirTransformer( originalTypeParameterCache.add(CopiedTypeParameterPair(it, new)) } } - typeParameters.clear() - typeParameters.addAll(newTypeParameters) + } - val newValueParameters = valueParameters.map { vp -> + private fun List.mapToNewValueParameters( + originalTypeParameterCache: MutableList + ): List { + return map { vp -> buildValueParameterCopy(vp) { symbol = FirValueParameterSymbol(vp.symbol.name) @@ -181,139 +193,70 @@ class SuspendTransformFirTransformer( } } } + } + + private fun FirReceiverParameter.copyToNew(originalTypeParameterCache: MutableList): FirReceiverParameter? { + return typeRef.coneTypeOrNull + ?.copyWithTypeParameters(originalTypeParameterCache) + ?.let { foundCopied -> + buildReceiverParameterCopy(this) { + typeRef = typeRef.withReplacedConeType(foundCopied) + } + } + } + + + private fun ConeKotlinType.copyConeType(originalTypeParameterCache: MutableList): ConeKotlinType? { + return copyWithTypeParameters(originalTypeParameterCache) + } + + private fun ConeKotlinType.copyConeTypeOrSelf(originalTypeParameterCache: MutableList): ConeKotlinType { + return copyConeType(originalTypeParameterCache) ?: this + } + + private fun FirSimpleFunctionBuilder.copyParameters() { + val originalTypeParameterCache = mutableListOf() + + val newTypeParameters = typeParameters.mapToNewTypeParameters(symbol, originalTypeParameterCache) + typeParameters.clear() + typeParameters.addAll(newTypeParameters) + + val newValueParameters = valueParameters.mapToNewValueParameters(originalTypeParameterCache) valueParameters.clear() valueParameters.addAll(newValueParameters) - receiverParameter?.also { receiverParameter -> - receiverParameter.typeRef.coneTypeOrNull - ?.copyWithTypeParameters(originalTypeParameterCache) - ?.also { foundCopied -> - this.receiverParameter = buildReceiverParameterCopy(receiverParameter) { - typeRef = typeRef.withReplacedConeType(foundCopied) - } - } + receiverParameter?.copyToNew(originalTypeParameterCache)?.also { + this.receiverParameter = it } val coneTypeOrNull = returnTypeRef.coneTypeOrNull if (coneTypeOrNull != null) { - returnTypeRef = returnTypeRef.withReplacedConeType( - coneTypeOrNull - .copyWithTypeParameters(originalTypeParameterCache) - ?: coneTypeOrNull, - ) + returnTypeRef = returnTypeRef + .withReplacedConeType(coneTypeOrNull.copyConeTypeOrSelf(originalTypeParameterCache)) } } -// private fun FirSimpleFunction.copySyntheticFun( -// owner: FirClassSymbol<*>, -// callableId: CallableId -// ): FirSimpleFunction { -// val origin = this -// -// val marker = buildValueParameter { -// source = origin.source -// moduleData = origin.moduleData -// this.origin = origin.origin -// returnTypeRef = buildResolvedTypeRef { -// coneType = StandardTypes.Int -// source = null -// } -// name = Name.identifier("__test_marker") -// symbol = FirValueParameterSymbol(name) -// defaultValue = buildLiteralExpression(null, ConstantValueKind.Int, 1, null, setType = true) -// containingFunctionSymbol = origin.symbol -// backingField = null -// isCrossinline = false -// isNoinline = false -// isVararg = false -// } -// -// val syntheticFun = buildSimpleFunctionCopy(this) { -// this.origin = FirDeclarationOrigin.Synthetic.FakeFunction -// name = callableId.callableName -// symbol = FirNamedFunctionSymbol(callableId) -// status = origin.status.copy( -// modality = Modality.OPEN, -// isOverride = false, -// visibility = Visibilities.Public -// ) -// -// copyParameters() -// -// this.valueParameters.add(0, marker) -// -// val builder = this -// -// body = buildSingleExpressionBlock( -// buildReturnExpression { -// target = FirFunctionTarget(null, false) -// result = buildFunctionCall { -// source = origin.source -// calleeReference = buildResolvedNamedReference { -// source = origin.source -// name = origin.name -// resolvedSymbol = origin.symbol -// } -// // TODO contextReceiverArguments -// -// argumentList = buildResolvedArgumentList( -// null, -// builder.valueParameters.associateByTo(LinkedHashMap()) { valueParameter -> -// buildCallableReferenceAccess { -// source = valueParameter.source -// calleeReference = buildResolvedNamedReference { -// source = valueParameter.source -// name = valueParameter.name -// resolvedSymbol = valueParameter.symbol -// } -// coneTypeOrNull = valueParameter.returnTypeRef.coneTypeOrNull -// } -// }) -// } -// } -// ) -// -// } -// -// syntheticFun.excludeFromJsExport(session) -// syntheticFun.jvmSynthetic(session) -// -// return syntheticFun -// } - - private fun FirSimpleFunction.appendTargetMarker(markerId: String) { - if (targetMarkerAnnotation != null) { - if (annotations.none { - it.fqName(session) == targetMarkerAnnotation.asSingleFqName() - && (it.argumentMapping.mapping[targetMarkerValueName] as? FirLiteralExpression) - ?.value == markerId - }) { - replaceAnnotations( - buildList { - addAll(annotations) - add(buildAnnotation { - argumentMapping = buildAnnotationArgumentMapping { - mapping[Name.identifier("value")] = buildLiteralExpression( - null, - ConstantValueKind.String, - markerId, - null, - true, - null - ) - } - annotationTypeRef = buildResolvedTypeRef { - coneType = targetMarkerAnnotation.createConeType(session) - } - }) - } - ) + private fun FirPropertyAccessorBuilder.copyParameters( + originalTypeParameterCache: MutableList = mutableListOf(), + copyReturnType: Boolean = true + ) { + val newTypeParameters = typeParameters.mapToNewTypeParameters(symbol, originalTypeParameterCache) + typeParameters.clear() + typeParameters.addAll(newTypeParameters) + + val newValueParameters = valueParameters.mapToNewValueParameters(originalTypeParameterCache) + valueParameters.clear() + valueParameters.addAll(newValueParameters) + + if (copyReturnType) { + val coneTypeOrNull = returnTypeRef.coneTypeOrNull + if (coneTypeOrNull != null) { + returnTypeRef = returnTypeRef + .withReplacedConeType(coneTypeOrNull.copyConeTypeOrSelf(originalTypeParameterCache)) } } - } - @OptIn(SymbolInternals::class) override fun generateFunctions( callableId: CallableId, context: MemberGenerationContext? @@ -326,103 +269,225 @@ class SuspendTransformFirTransformer( val funList = arrayListOf() funcMap.forEach { (func, funData) -> - when (funData) { - is BridgeFunData -> { - generateBridgeFunctions( - callableId, - context, - owner, - func, - funData, - funList, - ) - } - - is SyntheticFunData -> { - generateSyntheticFunctions( - callableId, - context, - owner, - func, - funData, - funList, - ) - } - } + generateSyntheticFunctions( + callableId, + owner, + func, + funData, + funList, + ) } return funList } - private fun generateBridgeFunctions( - callableId: CallableId, - context: MemberGenerationContext?, - owner: FirClassSymbol<*>, + + @OptIn(SymbolInternals::class) + private fun generateSyntheticFunctionBody( + originFunc: FirSimpleFunction, originFunSymbol: FirNamedFunctionSymbol, - funData: BridgeFunData, - results: MutableList, - ) { - // private inline fun $name(block: suspend () -> T): returnType // IR -> {} - val key = SuspendTransformBridgeFunctionKey( - data = SuspendTransformBridgeFunDataFir( - asProperty = false, - transformer = funData.transformer - ) - ) + owner: FirClassSymbol<*>, + thisContextReceivers: MutableList, + thisReceiverParameter: FirReceiverParameter?, + newFunSymbol: FirBasedSymbol<*>, + thisValueParameters: MutableList, + bridgeFunSymbol: FirNamedFunctionSymbol, + newFunTarget: FirFunctionTarget, + transformer: Transformer + ): FirBlock = buildBlock { + this.source = originFunc.body?.source + + // lambda: suspend () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.resolvePhase = FirResolvePhase.BODY_RESOLVE + this.isLambda = true + this.moduleData = originFunSymbol.moduleData + this.origin = FirDeclarationOrigin.Synthetic.FakeFunction + this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef + this.hasExplicitParameterList = false + this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType + this.source = originFunSymbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunSymbol.source + this.name = originFunSymbol.name + this.resolvedSymbol = originFunSymbol + } + + val originValueParameters = originFunc.valueParameters + + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + } + + // TODO? + this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> + buildThisReceiverExpression { + coneTypeOrNull = receiver.typeRef.coneTypeOrNull + source = receiver.source + calleeReference = buildExplicitThisReference { + source = receiver.source + labelName = receiver.labelName?.asString() + } + } + }) + + // TODO What is explicitReceiver? + this.extensionReceiver = thisReceiverParameter?.let { thisReceiverParameter -> + buildThisReceiverExpression { + coneTypeOrNull = thisReceiverParameter.typeRef.coneTypeOrNull + source = thisReceiverParameter.source + calleeReference = buildImplicitThisReference { + boundSymbol = newFunSymbol + } + } + } - val bridgeFun = buildSimpleFunction { - name = funData.funName - source = originFunSymbol.source - moduleData = originFunSymbol.moduleData - // see FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS - status = FirResolvedDeclarationStatusImpl( - Visibilities.Private, - Modality.FINAL, - EffectiveVisibility.PrivateInClass - ).copy( - visibility = Visibilities.Private, - modality = Modality.FINAL, - isOverride = false, - isSuspend = false, - isInline = true, + if (thisValueParameters.isNotEmpty()) { + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + thisValueParameters.forEachIndexed { index, thisParam -> + val qualifiedAccess = thisParam.toQualifiedAccess() + put(qualifiedAccess, originValueParameters[index]) + } + } + ) + } + } + } ) - returnTypeRef = funData.returnType - receiverParameter = null - containerSource = originFunSymbol.containerSource - dispatchReceiverType = originFunSymbol.dispatchReceiverType - // TODO 泛型需不需要处理? - valueParameters.add(funData.lambdaParameter) - body = null - symbol = funData.symbol - - // TODO 仅保留跟 originFun.returnType 一样或相关的 type parameter? -// val returnConeType = originFunSymbol.resolvedReturnTypeRef.coneType -// originFunSymbol.typeParameterSymbols.find { originTypeParameterSymbol -> -// returnConeType.copyWithTypeParameters() -// originTypeParameterSymbol -// TODO() -// } - - origin = key.origin + + this.typeRef = buildResolvedTypeRef { + this.coneType = StandardClassIds.SuspendFunctionN(0) + .createConeType(session, arrayOf(originFunSymbol.resolvedReturnType)) + } } + lambdaTarget.bind(lambda) - bridgeFun.jvmSynthetic(session) + val returnType = resolveReturnType(transformer, originFunc.returnTypeRef) - funData.target.bind(bridgeFun) + this.statements.add( + buildReturnExpression { + this.target = newFunTarget + this.result = buildFunctionCall { + this.coneTypeOrNull = returnType.coneType + this.source = originFunc.body?.source + this.calleeReference = buildResolvedNamedReference { + this.source = bridgeFunSymbol.source + this.name = bridgeFunSymbol.name + this.resolvedSymbol = bridgeFunSymbol + } + + // this.dispatchReceiver = buildThisReceiverExpression { + // coneTypeOrNull = originFunSymbol.dispatchReceiverType + // source = originFunSymbol.source + // calleeReference = buildImplicitThisReference { + // boundSymbol = owner + // } + // } + + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put( + buildAnonymousFunctionExpression { + source = null + anonymousFunction = lambda + isTrailingLambda = false + }, + // funData.bridgeFunData.lambdaParameter + bridgeFunSymbol.valueParameterSymbols.first().fir + ) + + // scope, if exists + val valueParameterSymbols = + bridgeFunSymbol.valueParameterSymbols + + if (valueParameterSymbols.size > 1) { + val secondParameter = valueParameterSymbols[1] + + val secondParameterType = secondParameter.resolvedReturnType + val secondParameterTypeNotNullable = + secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) + + val isCoroutineScope = secondParameterTypeNotNullable.isSubtypeOf( + coroutineScopeSymbol.toLookupTag().constructClassType(), + session, + ) + + if (isCoroutineScope) { + if (secondParameterType.isMarkedNullable) { + // this as? CoroutineScope + + val secondParameterTypeNotNullable = + secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull( + session.typeContext + ) + + put( + buildTypeOperatorCall { + source = originFunSymbol.source + coneTypeOrNull = secondParameterTypeNotNullable + argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put( + buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + }, + secondParameter.fir + ) + } + ) + operation = FirOperation.SAFE_AS + conversionTypeRef = + secondParameterTypeNotNullable.toFirResolvedTypeRef() + + }, + secondParameter.fir + ) + + } else { + // this as CoroutineScope + // or throw error? + + } + + } + } - results.add(bridgeFun.symbol) + } + ) + } + } + ) } @OptIn(SymbolInternals::class) private fun generateSyntheticFunctions( callableId: CallableId, - context: MemberGenerationContext?, owner: FirClassSymbol<*>, originFunSymbol: FirNamedFunctionSymbol, funData: SyntheticFunData, results: MutableList, ) { - val bridgeFunData = funData.bridgeFunData + val realBridgeFunSymbol = funData.transformerFunctionSymbol val annotationData = funData.annotationData if (!annotationData.asProperty) { @@ -433,33 +498,25 @@ class SuspendTransformFirTransformer( // generate val originFunc = originFunSymbol.fir - val uniqueFunHash = originFunc.calculateOriginFuncHash() - - // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 - -// val syntheticFunCallableName = callableId.callableName.asString() + "-f-${uniqueFunHash}" -// val syntheticFunName = callableId.copy(Name.identifier(syntheticFunCallableName)) -// val syntheticFun = originFunc.copySyntheticFun(owner, callableId) -// funList.add(syntheticFun.symbol) - - val (functionAnnotations, _) = copyAnnotations(originFunc, funData) + val (functionAnnotations, _, includeToOriginal) = copyAnnotations(originFunc, funData) val newFunSymbol = FirNamedFunctionSymbol(callableId) - val key = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = originFunc.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = originFunc.typeParameters, - valueParameters = originFunc.valueParameters, - originFunc.returnTypeRef.coneTypeOrNull?.classId, - session, - ), - asProperty = false, - transformer = funData.transformer - ) - ) +// val key = SuspendTransformPluginKey( +// data = SuspendTransformUserDataFir( +// markerId = UUID.randomUUID().toString(), +// originSymbol = originFunc.symbol.asOriginSymbol( +// targetMarkerAnnotation, +// typeParameters = originFunc.typeParameters, +// valueParameters = originFunc.valueParameters, +// originFunc.returnTypeRef.coneTypeOrNull?.classId, +// session, +// ), +// asProperty = false, +// transformer = funData.transformer +// ) +// ) + val key = SuspendTransformK2V3Key val newFunTarget = FirFunctionTarget(null, isLambda = false) val newFun = buildSimpleFunctionCopy(originFunc) { @@ -478,6 +535,10 @@ class SuspendTransformFirTransformer( ), ) +// val returnType = resolveReturnType(originFunc, funData, returnTypeRef) +// returnTypeRef = returnType +// returnTypeRef = funData.bridgeFunData.returnType + // Copy the typeParameters. // Otherwise, in functions like the following, an error will occur // suspend fun data(value: A): T = ... @@ -485,10 +546,11 @@ class SuspendTransformFirTransformer( // In the generated IR, data and dataBlocking will share an `A`, generating the error. // The error: Duplicate IR node // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] - // TODO copy to value parameters, receiver and - // return type? copyParameters() + // resolve returnType (with wrapped) after copyParameters + returnTypeRef = resolveReturnType(funData.transformer, returnTypeRef) + val thisReceiverParameter = this.receiverParameter val thisContextReceivers = this.contextReceivers val thisValueParameters = this.valueParameters @@ -496,139 +558,27 @@ class SuspendTransformFirTransformer( annotations.clear() annotations.addAll(functionAnnotations) - returnTypeRef = funData.bridgeFunData.returnType - - /* - * __suspendTransform__run_0_runBlocking({ run(times) }) - */ - - body = buildBlock { - this.source = originFunc.body?.source - - // lambda: suspend () -> T - val lambdaTarget = FirFunctionTarget(null, isLambda = true) - val lambda = buildAnonymousFunction { - this.isLambda = true - this.moduleData = originFunSymbol.moduleData -// this.origin = key.origin - this.origin = FirDeclarationOrigin.Synthetic.FakeFunction - this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef - this.hasExplicitParameterList = false - this.status = - FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - this.symbol = FirAnonymousFunctionSymbol() - this.body = buildSingleExpressionBlock( - buildReturnExpression { - target = lambdaTarget - result = buildFunctionCall { - // Call original fun - this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType - this.source = originFunSymbol.source - this.calleeReference = buildResolvedNamedReference { - this.source = originFunSymbol.source - this.name = originFunSymbol.name - this.resolvedSymbol = originFunSymbol - } - - val originValueParameters = originFunc.valueParameters - - this.dispatchReceiver = buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType - source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } - } - - // TODO? - this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> - buildThisReceiverExpression { - coneTypeOrNull = receiver.typeRef.coneTypeOrNull - source = receiver.source - calleeReference = buildExplicitThisReference { - source = receiver.source - labelName = receiver.labelName?.asString() - } - } - }) - - // TODO? - this.explicitReceiver = thisReceiverParameter?.let { thisExplicitReceiver -> - buildThisReceiverExpression { - coneTypeOrNull = thisExplicitReceiver.typeRef.coneTypeOrNull - source = thisExplicitReceiver.source - calleeReference = buildExplicitThisReference { - source = thisExplicitReceiver.source - } - } - } - - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - thisValueParameters.forEachIndexed { index, thisParam -> - val qualifiedAccess = thisParam.toQualifiedAccess() - put(qualifiedAccess, originValueParameters[index]) - } - } - ) - } - } - ) - - this.typeRef = bridgeFunData.lambdaParameter.returnTypeRef - } - lambdaTarget.bind(lambda) - - // bind to bridge fun - - this.statements.add( - buildReturnExpression { - this.target = newFunTarget - this.result = buildFunctionCall { - this.coneTypeOrNull = bridgeFunData.returnType.coneType - this.source = bridgeFunData.symbol.source - this.calleeReference = buildResolvedNamedReference { - this.source = bridgeFunData.symbol.source - this.name = bridgeFunData.symbol.name - this.resolvedSymbol = bridgeFunData.symbol - } - - this.dispatchReceiver = buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType - source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } - } - - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - put(buildAnonymousFunctionExpression { - source = null - anonymousFunction = lambda - isTrailingLambda = false - }, funData.bridgeFunData.lambdaParameter) - } - ) - } - } - ) - } - // body = null + body = generateSyntheticFunctionBody( + originFunc, + originFunSymbol, + owner, + thisContextReceivers, + thisReceiverParameter, + newFunSymbol, + thisValueParameters, + realBridgeFunSymbol, + newFunTarget, + funData.transformer + ) origin = key.origin } - if (targetMarkerAnnotation != null) { - originFunc.appendTargetMarker(uniqueFunHash) - } - - // TODO 在原函数上附加的annotations - newFunTarget.bind(newFun) results.add(newFun.symbol) + + // 在原函数上附加的annotations + originFunc.includeAnnotations(includeToOriginal) } } @@ -645,153 +595,152 @@ class SuspendTransformFirTransformer( val propList = mutableListOf() for ((originalFunSymbol, funData) in funcMap) { - if (funData !is SyntheticFunData) { + val annotationData = funData.annotationData + + if (!annotationData.asProperty) { continue } - val annotationData = funData.annotationData - if (annotationData.asProperty) { - val isOverride = - checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) - - // generate - val original = originalFunSymbol.fir - - val uniqueFunHash = original.calculateOriginFuncHash() - - val (functionAnnotations, propertyAnnotations) = - copyAnnotations(original, funData) - - // val p = createMemberProperty() - // owner = owner, - // key = SuspendTransformPluginKey( - // data = SuspendTransformUserDataFir( - // originSymbol = original.symbol.asOriginSymbol( - // typeParameters = original.typeParameters, - // valueParameters = original.valueParameters, - // original.returnTypeRef.coneTypeOrNull?.classId - // ), - // asProperty = true, - // transformer = funData.transformer - // ) - // ), - // name = callableId.callableName, - // returnTypeProvider = { resolveReturnConeType(original, funData) }, - // isVal = true, - // hasBackingField = false, - // ) { - // modality = original.syntheticModifier ?: Modality.FINAL - // // TODO receiver? - //// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull - //// if (receiverType != null) { - //// extensionReceiverType(receiverType) - //// } - // } - - val pSymbol = FirPropertySymbol(callableId) - val pKey = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = original.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = original.typeParameters, - valueParameters = original.valueParameters, - original.returnTypeRef.coneTypeOrNull?.classId, - session - ), - asProperty = true, - transformer = funData.transformer - ) - ) + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) + // generate + val original = originalFunSymbol.fir + + val (functionAnnotations, propertyAnnotations, includeToOriginal) = + copyAnnotations(original, funData) + + val pSymbol = FirPropertySymbol(callableId) + +// val pKey = SuspendTransformPluginKey( +// data = SuspendTransformUserDataFir( +// markerId = uniqueFunHash, +// originSymbol = original.symbol.asOriginSymbol( +// targetMarkerAnnotation, +// typeParameters = original.typeParameters, +// valueParameters = original.valueParameters, +// original.returnTypeRef.coneTypeOrNull?.classId, +// session +// ), +// asProperty = true, +// transformer = funData.transformer +// ) +// ) + val pKey = SuspendTransformK2V3Key + + val originalReturnType = original.returnTypeRef + + val originalTypeParameterCache: MutableList = mutableListOf() + val copiedReturnType = originalReturnType.withReplacedConeType( + originalReturnType.coneTypeOrNull?.copyConeTypeOrSelf(originalTypeParameterCache) + ) + + // copy完了再resolve,这样里面包的type parameter就不会有问题了(如果有type parameter的话) + val resolvedReturnType = resolveReturnType(funData.transformer, copiedReturnType) + + val newFunTarget = FirFunctionTarget(null, isLambda = false) - val returnType = resolveReturnType(funData.transformer, original.returnTypeRef) + val p1 = buildProperty { + symbol = pSymbol + name = callableId.callableName + source = original.source + resolvePhase = original.resolvePhase + moduleData = original.moduleData + origin = pKey.origin + attributes = original.attributes.copy() + status = original.status.copy( + isSuspend = false, + isFun = false, + isInner = false, + modality = original.syntheticModifier, + isOverride = isOverride || isOverridable( + session, + callableId.callableName, + original, + owner, + isProperty = true + ), + ) - val p1 = buildProperty { - symbol = pSymbol - name = callableId.callableName - source = original.source - resolvePhase = original.resolvePhase + isVar = false + isLocal = false + // Copy return type + returnTypeRef = resolvedReturnType + deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider + containerSource = original.containerSource + dispatchReceiverType = original.dispatchReceiverType + contextReceivers.addAll(original.contextReceivers) + // annotations + annotations.addAll(propertyAnnotations) + typeParameters.addAll(original.typeParameters) + resolvePhase = FirResolvePhase.BODY_RESOLVE + backingField = null + bodyResolveState = FirPropertyBodyResolveState.NOTHING_RESOLVED + + getter = buildPropertyAccessor { + propertySymbol = pSymbol + val propertyAccessorSymbol = FirPropertyAccessorSymbol() + symbol = propertyAccessorSymbol + isGetter = true + resolvePhase = FirResolvePhase.BODY_RESOLVE moduleData = original.moduleData + + // annotations + annotations.addAll(functionAnnotations) + + returnTypeRef = resolvedReturnType origin = pKey.origin - attributes = original.attributes.copy() + status = original.status.copy( isSuspend = false, isFun = false, isInner = false, - // modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, modality = original.syntheticModifier, - isOverride = isOverride || isOverridable( - session, - callableId.callableName, - original, - owner, - isProperty = true - ), + isOverride = false, // funData.isOverride, + // visibility = this@buildProperty.status ) - isVar = false - isLocal = false - returnTypeRef = returnType - deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider - containerSource = original.containerSource - dispatchReceiverType = original.dispatchReceiverType - contextReceivers.addAll(original.contextReceivers) - // annotations - annotations.addAll(propertyAnnotations) + valueParameters.addAll(original.valueParameters) typeParameters.addAll(original.typeParameters) - resolvePhase = FirResolvePhase.BODY_RESOLVE - backingField = null - bodyResolveState = FirPropertyBodyResolveState.NOTHING_RESOLVED - - getter = buildPropertyAccessor { - propertySymbol = pSymbol - symbol = FirPropertyAccessorSymbol() - isGetter = true - resolvePhase = FirResolvePhase.BODY_RESOLVE - moduleData = original.moduleData - - // annotations - annotations.addAll(functionAnnotations) - - returnTypeRef = returnType - - origin = pKey.origin - - // attributes = original.attributes.copy() - status = original.status.copy( - isSuspend = false, - isFun = false, - isInner = false, - modality = original.syntheticModifier, - isOverride = false, // funData.isOverride, - // visibility = this@buildProperty.status - ) - returnTypeRef = original.returnTypeRef - // deprecationsProvider = original.deprecationsProvider - // containerSource = original.containerSource - // dispatchReceiverType = original.dispatchReceiverType - // contextReceivers.addAll(original.contextReceivers) - valueParameters.addAll(original.valueParameters) - // body = null - // contractDescription = original.contractDescription - typeParameters.addAll(original.typeParameters) - } - } + contextReceivers.addAll(original.contextReceivers) - propList.add(p1.symbol) + copyParameters(originalTypeParameterCache, false) - if (targetMarkerAnnotation != null) { - original.appendTargetMarker(uniqueFunHash) - } + val thisContextReceivers = this.contextReceivers + val thisValueParameters = this.valueParameters - // TODO 在原函数上附加的annotations + body = generateSyntheticFunctionBody( + original, + originalFunSymbol, + owner, + thisContextReceivers, + null, + propertyAccessorSymbol, + thisValueParameters, + funData.transformerFunctionSymbol, + newFunTarget, + funData.transformer + ) + }.also { getter -> + newFunTarget.bind(getter) + } } + + propList.add(p1.symbol) + +// if (targetMarkerAnnotation != null) { +// original.appendTargetMarker(uniqueFunHash) +// } + + // 在原函数上附加的annotations + original.includeAnnotations(includeToOriginal) + } return propList } + private fun checkSyntheticFunctionIsOverrideBasedOnSourceFunction( syntheticFunData: SyntheticFunData, func: FirNamedFunctionSymbol, @@ -881,7 +830,7 @@ class SuspendTransformFirTransformer( private fun createCache( classSymbol: FirClassSymbol<*>, declaredScope: FirClassDeclaredMemberScope? - ): Map>? { + ): Map>? { if (declaredScope == null) return null fun check(targetPlatform: TargetPlatform): Boolean { @@ -897,31 +846,22 @@ class SuspendTransformFirTransformer( } } - // TODO - // https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin/issues/75 - // 原始函数生成两个函数: - // 1. xxxBlocking 真正要生成的函数 - // 2. __suspendTransform__$funName_$index_$transFunName 用于提供给 IR 直接生成body的private桥接函数 - - // fun.name -> Counter - val funNameCounters = mutableMapOf() - - fun resolveFunNameCount(name: String): Int = funNameCounters.computeIfAbsent(name) { - AtomicInteger(0) - }.andIncrement - - // Key -> synthetic fun name or bridge fun name + // Key -> synthetic fun name // Value Map -> // Key: -> origin fun symbol // Values -> FunData - val map = ConcurrentHashMap>() + val map = ConcurrentHashMap>() +// val transformerFunctionSymbolMap = ConcurrentHashMap() + + val platformTransformers = suspendTransformConfiguration.transformers + .filter { (platform, _) -> check(platform) } declaredScope.processAllFunctions { func -> if (!func.isSuspend) return@processAllFunctions val functionName = func.name.asString() - suspendTransformConfiguration.transformers.asSequence() - .filter { (platform, _) -> check(platform) } + + platformTransformers .forEach { (_, transformerList) -> for (transformer in transformerList) { val markAnnotation = transformer.markAnnotation @@ -929,6 +869,8 @@ class SuspendTransformFirTransformer( val anno = firAnnotation(func, markAnnotation, classSymbol) ?: continue + val transformerFunctionSymbol = transformerFunctionSymbolMap[transformer] + ?: error("Cannot find transformer function symbol for transformer: $transformer") // 读不到注解的参数? // 必须使用 anno.getXxxArgument(Name(argument name)), @@ -936,78 +878,18 @@ class SuspendTransformFirTransformer( // println("RAW AnnoData: ${anno.argumentMapping.mapping}") val annoData = anno.toTransformAnnotationData(markAnnotation, functionName) - val funCount = resolveFunNameCount(functionName) - val syntheticFunNameString = annoData.functionName - val bridgeFunNameString = bridgeFunName(functionName, funCount, syntheticFunNameString) val syntheticFunName = Name.identifier(syntheticFunNameString) - val bridgeFunName = Name.identifier(bridgeFunNameString) - - val bridgeFunCallableId = func.callableId.replaceName(bridgeFunName) - - val bridgeFunSymbol = FirNamedFunctionSymbol(bridgeFunCallableId) - - // noinline suspend () -> T - val suspendLambdaValueParameter = buildValueParameter { - source = func.source - resolvePhase = FirResolvePhase.RAW_FIR - moduleData = func.moduleData - origin = FirDeclarationOrigin.Synthetic.FakeFunction - - returnTypeRef = buildResolvedTypeRef { - source = func.source - val funTypeRef = buildFunctionTypeRef { - source = func.source - isMarkedNullable = false - receiverTypeRef = null - isSuspend = true - returnTypeRef = func.resolvedReturnTypeRef - } - - delegatedTypeRef = funTypeRef - - coneType = session.typeResolver.resolveType( - funTypeRef, - ScopeClassDeclaration(emptyList(), emptyList()), - false, - false, - false, - null, - SupertypeSupplier.Default, - ).type - } - - backingField = null - defaultValue = null - val pname = Name.identifier("block") - name = pname - symbol = FirValueParameterSymbol(pname) - containingFunctionSymbol = bridgeFunSymbol - isVararg = false - isCrossinline = false - isNoinline = true - } - - val returnType = resolveReturnType(transformer, func.resolvedReturnTypeRef) - - val bridgeFunData = BridgeFunData( - bridgeFunName, - bridgeFunSymbol, - FirFunctionTarget(null, false), - suspendLambdaValueParameter, - returnType, - annoData, - transformer - ) - - map.computeIfAbsent(bridgeFunName) { name -> - ConcurrentHashMap() - }[func] = bridgeFunData map.computeIfAbsent(syntheticFunName) { ConcurrentHashMap() - }[func] = SyntheticFunData(syntheticFunName, bridgeFunData) + }[func] = SyntheticFunData( + syntheticFunName, + annoData, + transformer, + transformerFunctionSymbol + ) } } } @@ -1015,11 +897,6 @@ class SuspendTransformFirTransformer( return map } - private fun bridgeFunName(original: String, count: Int, syntheticFun: String): String { - // __suspendTransform__run_0_runBlocking - return "__suspendTransform__${original}_${count}_${syntheticFun}" - } - private fun FirAnnotation.toTransformAnnotationData( markAnnotation: MarkAnnotation, sourceFunctionName: String @@ -1093,9 +970,11 @@ class SuspendTransformFirTransformer( */ private fun copyAnnotations( original: FirSimpleFunction, syntheticFunData: SyntheticFunData, - ): Pair, List> { + ): CopyAnnotations { val transformer = syntheticFunData.transformer + val originalAnnotationClassIdMap = original.annotations.keysToMap { it.toAnnotationClassId(session) } + val (copyFunction, copyProperty, excludes, includes) = CopyAnnotationsData( transformer.copyAnnotationsToSyntheticFunction, transformer.copyAnnotationsToSyntheticProperty, @@ -1105,10 +984,10 @@ class SuspendTransformFirTransformer( val functionAnnotationList = buildList { if (copyFunction) { - val notCompileAnnotationsCopied = original.annotations.filterNot { - val annotationClassId = it.toAnnotationClassId(session) ?: return@filterNot true - annotationClassId == targetMarkerAnnotation || excludes.any { ex -> annotationClassId == ex } - } + val notCompileAnnotationsCopied = originalAnnotationClassIdMap.filterNot { (_, annotationClassId) -> + if (annotationClassId == null) return@filterNot true + excludes.any { ex -> annotationClassId == ex } + }.keys /* * Create a new annotation based the annotation from the original function. @@ -1150,10 +1029,10 @@ class SuspendTransformFirTransformer( val propertyAnnotationList = buildList { if (copyProperty) { - val notCompileAnnotationsCopied = original.annotations.filterNot { - val annotationClassId = it.toAnnotationClassId(session) ?: return@filterNot true + val notCompileAnnotationsCopied = originalAnnotationClassIdMap.filterNot { (_, annotationClassId) -> + if (annotationClassId == null) return@filterNot true excludes.any { ex -> annotationClassId == ex } - } + }.keys addAll(notCompileAnnotationsCopied) } @@ -1173,58 +1052,29 @@ class SuspendTransformFirTransformer( } } - return functionAnnotationList to propertyAnnotationList - } - - - private fun FirAnnotationArgumentMappingBuilder.includeGeneratedArguments(function: FirSimpleFunction) { - fun MutableList.addString(value: String) { - val expression = buildLiteralExpression( - source = null, - kind = ConstantValueKind.String, - value = value, - setType = false - ) + // original annotations - add(expression) - } + val infos = transformer.originFunctionIncludeAnnotations.map { it.toInfo() } - fun ConeKotlinType.typeString(): String { - return buildString { - append(classId?.asFqNameString()) - collectUpperBounds() - .takeIf { it.isNotEmpty() } - ?.also { upperBounds -> - upperBounds.joinTo(this, "&") { type -> - type.classId?.asFqNameString() ?: "?NULL?" - } - } - if (this@typeString is ConeClassLikeType && typeArguments.isNotEmpty()) { - typeArguments.joinTo(this, ", ", "<", ">") { argument -> - argument.type?.classId?.asFqNameString() ?: "?NULL?" + val includeToOriginals: List = infos + .mapNotNull { (classId, repeatable, _) -> + if (!repeatable) { + // 不能是已经存在的 + if (originalAnnotationClassIdMap.values.any { it == classId }) { + return@mapNotNull null } } - } - } - with(mapping) { - put(Name.identifier("by"), buildArrayLiteral { - argumentList = buildArgumentList { - with(arguments) { - addString(function.name.asString()) - function.valueParameters.forEach { vp -> - addString(vp.name.asString()) - vp.returnTypeRef.coneTypeOrNull?.also { coneType -> - addString(coneType.typeString()) - } - } - addString(function.returnTypeRef.coneTypeOrNull?.typeString() ?: "?") + buildAnnotation { + argumentMapping = buildAnnotationArgumentMapping() + annotationTypeRef = buildResolvedTypeRef { + coneType = classId.createConeType(session) } } - }) - } - } + } + return CopyAnnotations(functionAnnotationList, propertyAnnotationList, includeToOriginals) + } private fun isOverridable( session: FirSession, @@ -1348,6 +1198,11 @@ class SuspendTransformFirTransformer( original.toConeType() == target }?.copied + val copiedThis = findCopied(this) + if (copiedThis != null) { + return copiedThis.toConeType() + } + when (this) { is ConeDynamicType -> { //println("Dynamic type: $this") @@ -1357,28 +1212,30 @@ class SuspendTransformFirTransformer( //println("Flexible type: $this") } - // var typeArguments: Array = emptyArray() - // - // if (transformer.transformReturnTypeGeneric) { - // typeArguments = arrayOf(ConeKotlinTypeProjectionOut(original.returnTypeRef.coneType)) - // } - is ConeClassLikeType -> { if (typeArguments.isNotEmpty()) { - fun mapProjection(projection: ConeTypeProjection): ConeTypeProjection? { + val findCopiedDirectly = projection.type?.let { type -> findCopied(type) } + if (findCopiedDirectly != null) { + return findCopiedDirectly.toConeType() + } + return when (projection) { - // is ConeFlexibleType -> { - // } + // is ConeFlexibleType -> { } + + is ConeClassLikeType -> { + projection.copyWithTypeParameters(parameters) + } + is ConeCapturedType -> { - val lowerType = projection.lowerType?.let { lowerType -> - findCopied(lowerType) - }?.toConeType() +// val lowerType = projection.lowerType?.let { lowerType -> +// findCopied(lowerType) +// }?.toConeType() + + val lowerType = projection.lowerType?.copyWithTypeParameters(parameters) if (lowerType == null) { - projection.copy( - lowerType = lowerType - ) + projection.copy(lowerType = lowerType) } else { null } @@ -1392,16 +1249,18 @@ class SuspendTransformFirTransformer( // is ConeIntegerConstantOperatorType -> TODO() // is ConeIntegerLiteralConstantType -> TODO() is ConeIntersectionType -> { - val upperBoundForApproximation = - projection.upperBoundForApproximation - ?.let { findCopied(it) } - ?.toConeType() + val upperBoundForApproximation = projection.upperBoundForApproximation + ?.copyWithTypeParameters(parameters) +// val upperBoundForApproximation = +// projection.upperBoundForApproximation +// ?.let { findCopied(it) } +// ?.toConeType() var anyIntersectedTypes = false val intersectedTypes = projection.intersectedTypes.map { ktype -> - findCopied(ktype) - ?.toConeType() + findCopied(ktype)?.toConeType() +// ktype.copyWithTypeParameters(parameters) ?.also { anyIntersectedTypes = true } ?: ktype } @@ -1417,33 +1276,42 @@ class SuspendTransformFirTransformer( } // is ConeLookupTagBasedType -> TODO() // is ConeStubTypeForTypeVariableInSubtyping -> TODO() - // is ConeTypeVariableType -> { - // TODO() - // } + // is ConeTypeVariableType -> TODO() is ConeKotlinTypeConflictingProjection -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeKotlinTypeProjectionIn -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeKotlinTypeProjectionOut -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeTypeParameterType -> { - findCopied(projection)?.toConeType() +// findCopied(projection)?.toConeType() + projection.copyWithTypeParameters(parameters) } - ConeStarProjection -> projection - // Other unknowns + ConeStarProjection -> ConeStarProjection + + // Other unknowns, e.g., ClassLike else -> null } } @@ -1466,17 +1334,18 @@ class SuspendTransformFirTransformer( } is ConeTypeParameterType -> { - return parameters.find { (original, _) -> - original.toConeType() == this - }?.copied?.toConeType() ?: this + return findCopied(this)?.toConeType() ?: this +// return parameters.find { (original, _) -> +// original.toConeType() == this +// }?.copied?.toConeType() ?: this } else -> { - + // ? } } - return this - // this.fullyExpandedClassId().createConeType() + + return null } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt index cc53c85..01f8e70 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt @@ -15,3 +15,8 @@ data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : data class SuspendTransformBridgeFunctionKey(val data: SuspendTransformBridgeFunDataFir) : SuspendTransformGeneratedDeclarationKey() + +/** + * The v3 logic for generating suspend bridge functions: generate body in FIR stage. + */ +object SuspendTransformK2V3Key : SuspendTransformGeneratedDeclarationKey() diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index a9646d4..c03aa9d 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -3,6 +3,7 @@ package love.forte.plugin.suspendtrans.ir import love.forte.plugin.suspendtrans.* import love.forte.plugin.suspendtrans.fir.SuspendTransformBridgeFunctionKey import love.forte.plugin.suspendtrans.fir.SuspendTransformGeneratedDeclarationKey +import love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key import love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext @@ -81,9 +82,15 @@ class SuspendTransformTransformer( val userData = descriptor.getUserData(SuspendTransformUserDataKey) val generatedOriginFunction: IrFunction? = when { - pluginKey != null -> { + // K2 v3, 如果已经有body了,则不再需要生成,直接跳过。 + declaration.body != null -> return null + pluginKey != null -> { when (pluginKey) { + // K2 v3, 通常是已经完成body生成的,跳过(应该到不了这一步,因为 body != null 已经在上面被检测过了 + is SuspendTransformK2V3Key -> null + + // K2 v2 is SuspendTransformBridgeFunctionKey -> { val callableFunction = pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) @@ -321,13 +328,15 @@ class SuspendTransformTransformer( function: IrFunction, transformTargetFunctionCall: IrSimpleFunctionSymbol, ) { - // body: return $transform(block, scope?) - function.body = generateTransformBodyForFunctionLambda( - pluginContext, - function, - null, - transformTargetFunctionCall - ) + if (function.body == null) { + // body: return $transform(block, scope?) + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + null, + transformTargetFunctionCall + ) + } } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt index 8db1b49..193eea1 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt @@ -1,71 +1,8 @@ package love.forte.plugin.suspendtrans.utils -import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.expressions.FirEmptyArgumentList -import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationCall -import org.jetbrains.kotlin.fir.moduleData -import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.defaultType -import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider -import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.platform.isJs -import org.jetbrains.kotlin.platform.jvm.isJvm -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull +import org.jetbrains.kotlin.fir.expressions.FirAnnotation -private val jsExportIgnore = ClassId.fromString("kotlin/js/JsExport.Ignore") -private val jvmSynthetic = ClassId.fromString("kotlin/jvm/JvmSynthetic") - -fun FirDeclaration.excludeFromJsExport(session: FirSession) { - if (!session.moduleData.platform.isJs()) { - return - } - val jsExportIgnore = session.symbolProvider.getClassLikeSymbolByClassId(jsExportIgnore) - val jsExportIgnoreAnnotation = jsExportIgnore as? FirRegularClassSymbol ?: return - val jsExportIgnoreConstructor = - jsExportIgnoreAnnotation.declarationSymbols.firstIsInstanceOrNull() ?: return - - val jsExportIgnoreAnnotationCall = buildAnnotationCall { - argumentList = FirEmptyArgumentList - annotationTypeRef = buildResolvedTypeRef { - coneType = jsExportIgnoreAnnotation.defaultType() - } - calleeReference = buildResolvedNamedReference { - name = jsExportIgnoreAnnotation.name - resolvedSymbol = jsExportIgnoreConstructor - } - - containingDeclarationSymbol = this@excludeFromJsExport.symbol - } - - replaceAnnotations(annotations + jsExportIgnoreAnnotationCall) -} - -fun FirDeclaration.jvmSynthetic(session: FirSession) { - if (!session.moduleData.platform.isJvm()) { - return - } - - val jvmSynthetic = session.symbolProvider.getClassLikeSymbolByClassId(jvmSynthetic) - val jvmExportIgnoreAnnotation = jvmSynthetic as? FirRegularClassSymbol ?: return - val jvmExportIgnoreConstructor = - jvmExportIgnoreAnnotation.declarationSymbols.firstIsInstanceOrNull() ?: return - - val jvmSyntheticAnnotationCall = buildAnnotationCall { - argumentList = FirEmptyArgumentList - annotationTypeRef = buildResolvedTypeRef { - coneType = jvmExportIgnoreAnnotation.defaultType() - } - calleeReference = buildResolvedNamedReference { - name = jvmExportIgnoreAnnotation.name - resolvedSymbol = jvmExportIgnoreConstructor - } - - containingDeclarationSymbol = this@jvmSynthetic.symbol - } - - replaceAnnotations(annotations + jvmSyntheticAnnotationCall) +fun FirDeclaration.includeAnnotations(includes: List) { + replaceAnnotations(annotations + includes) } diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index 505d025..d0d454a 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -44,6 +44,12 @@ public void testTypeAttr() { runTest("src/testData/codegen/typeAttr.kt"); } + @Test + @TestMetadata("typeAttrNested.kt") + public void testTypeAttrNested() { + runTest("src/testData/codegen/typeAttrNested.kt"); + } + @Test @TestMetadata("opt.kt") public void testOpt() { diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt index 8dfe997..8b63a10 100644 --- a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt @@ -50,17 +50,33 @@ class SuspendTransformerEnvironmentConfigurator(testServices: TestServices) : En it ) } + + // register coroutines + getRuntimeJarFile("kotlinx.coroutines.CoroutineScope")?.let { + configuration.addJvmClasspathRoot( + it + ) + } } private fun getRuntimeJarFile(className: String): File? { try { - val clazz = Class.forName(className) - return PathUtil.getResourcePathForClass(clazz) - } catch (e: ClassNotFoundException) { + return getRuntimeJarFile(Class.forName(className)) + } catch (_: ClassNotFoundException) { System.err.println("Runtime jar '$className' not found!") // assert(false) { "Runtime jar '$className' not found!" } } return null } + private fun getRuntimeJarFile(clazz: Class<*>): File { +// try { + return PathUtil.getResourcePathForClass(clazz) +// } catch (e: ClassNotFoundException) { +// System.err.println("Runtime jar '$clazz' not found!") +//// assert(false) { "Runtime jar '$className' not found!" } +// } +// return null + } + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt index dd3bc1b..5b7f753 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt @@ -18,7 +18,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.MyClass @@ -27,26 +27,28 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun errorReproductionAsync (amount: kotlin.Long): java.util.concurrent.CompletableFuture declared in .MyClass' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .MyClass.errorReproductionAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionAsync' CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionAsync' type=kotlin.Long origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit annotations: Api4J $this: VALUE_PARAMETER name: type:.MyClass VALUE_PARAMETER name:amount index:0 type:kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun errorReproductionBlocking (amount: kotlin.Long): kotlin.Unit declared in .MyClass' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Unit origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionBlocking' type=.MyClass origin=null amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionBlocking' type=kotlin.Long origin=null @@ -54,7 +56,6 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=") JvmSynthetic $this: VALUE_PARAMETER name: type:.MyClass VALUE_PARAMETER name:amount index:0 type:kotlin.Long diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt index dee753c..c89ed2c 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt @@ -5,12 +5,22 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=)) public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { R|kotlin/io/println|(R|/amount|) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| { + ^errorReproductionAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Unit| { + ^ this@R|/MyClass|.R|/MyClass.errorReproduction|(R|/amount|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + ^errorReproductionBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Unit| { + ^ this@R|/MyClass|.R|/MyClass.errorReproduction|(R|/amount|) + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt index 94fc8b0..96829f4 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt @@ -22,48 +22,49 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcFByb3BGb29udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:FINAL [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .PropFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:FINAL [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropImpl CONSTRUCTOR visibility:public <> () returnType:.PropImpl [primary] @@ -87,7 +88,6 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcFByb3BJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun prop (): kotlin.String declared in .IProp @@ -95,37 +95,37 @@ FILE fqName: fileName:/Main.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun prop (): kotlin.String declared in .PropImpl' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] annotations: Api4J overridden: public open prop: kotlin.String declared in .IProp - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] overridden: public open fun (): kotlin.String declared in .IProp $this: VALUE_PARAMETER name: type:.PropImpl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .PropImpl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] annotations: Api4J overridden: public open propAsync: java.util.concurrent.CompletableFuture declared in .IProp - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] overridden: public open fun (): java.util.concurrent.CompletableFuture declared in .IProp $this: VALUE_PARAMETER name: type:.PropImpl @@ -133,12 +133,14 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .PropImpl' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropImpl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null CLASS INTERFACE name:IProp modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IProp FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] @@ -158,42 +160,43 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcElQcm9wbnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.IProp - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] $this: VALUE_PARAMETER name: type:.IProp BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .IProp' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] $this: VALUE_PARAMETER name: type:.IProp BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .IProp' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IProp.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt index 8e4a88a..27e0fa3 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt @@ -4,25 +4,45 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BGb29udWxs)) public final suspend fun prop(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public final suspend fun prop(): R|kotlin/String| { ^prop String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropFoo|.R|/PropFoo.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropFoo|.R|/PropFoo.prop|() + } + , (this@R|/PropFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public abstract interface IProp : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcElQcm9wbnVsbA==)) public abstract suspend fun prop(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun prop(): R|kotlin/String| @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/IProp|.R|/IProp.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/IProp|.R|/IProp.prop|() + } + , (this@R|/IProp| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class PropImpl : R|IProp| { @@ -30,14 +50,24 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BJbXBsbnVsbA==)) public open override suspend fun prop(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun prop(): R|kotlin/String| { ^prop String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropImpl|.R|/PropImpl.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropImpl|.R|/PropImpl.prop|() + } + , (this@R|/PropImpl| as? R|kotlinx/coroutines/CoroutineScope|)) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt index e81cdb2..275a65b 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt @@ -18,7 +18,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicBar @@ -27,14 +27,16 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicBar.bar2Async' CALL 'public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicBar @@ -42,16 +44,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicBar.barAsync' CALL 'public final fun bar (): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyQmFzaWNCYXJudWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar BLOCK_BODY @@ -60,7 +63,6 @@ FILE fqName: fileName:/Main.kt FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar VALUE_PARAMETER name:i index:0 type:kotlin.Int @@ -86,7 +88,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicFoo @@ -94,16 +96,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicFoo.fooAsync' CALL 'public final fun foo (): kotlin.String declared in .BasicFoo' type=kotlin.String origin=null $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "Zm9vQmFzaWNGb29udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicFoo BLOCK_BODY @@ -144,7 +147,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.InterfaceBar @@ -153,14 +156,16 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .InterfaceBar.bar2Async' CALL 'public abstract fun bar2 (i: kotlin.Int): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.InterfaceBar @@ -168,25 +173,25 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .InterfaceBar.barAsync' CALL 'public abstract fun bar (): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFySW50ZXJmYWNlQmFybnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50") JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt index ca0b8f6..3dbb328 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt @@ -4,11 +4,16 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(Zm9vQmFzaWNGb29udWxs)) public final suspend fun foo(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun foo(): R|kotlin/String| { ^foo String(foo) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| { + ^fooAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicFoo|.R|/BasicFoo.foo|() + } + , (this@R|/BasicFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class BasicBar : R|kotlin/Any| { @@ -16,29 +21,49 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyQmFzaWNCYXJudWxs)) public final suspend fun bar(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun bar(): R|kotlin/String| { ^bar String(bar) } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=)) public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { ^bar2 String(bar2) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^bar2Async R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicBar|.R|/BasicBar.bar2|(R|/i|) + } + , (this@R|/BasicBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| { + ^barAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicBar|.R|/BasicBar.bar|() + } + , (this@R|/BasicBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public abstract interface InterfaceBar : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFySW50ZXJmYWNlQmFybnVsbA==)) public abstract suspend fun bar(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun bar(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50)) public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| public abstract fun asyncBase(i: R|kotlin/Int|): R|ResultValue| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^bar2Async R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/InterfaceBar|.R|/InterfaceBar.bar2|(R|/i|) + } + , (this@R|/InterfaceBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| { + ^barAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/InterfaceBar|.R|/InterfaceBar.bar|() + } + , (this@R|/InterfaceBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class ResultValue : R|kotlin/Any| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt index 2dae78c..3117171 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt @@ -18,56 +18,55 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface1 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface1Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' CALL 'public open fun data3 (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface1 @@ -78,7 +77,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1 @@ -90,7 +88,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): kotlin.String declared in .FooInterface1 @@ -118,7 +115,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface2 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -127,16 +124,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface2Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -145,16 +142,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' CALL 'public open fun data3 (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String annotations: Api4J overridden: @@ -162,18 +159,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface2Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface2 @@ -184,7 +180,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2 @@ -196,7 +191,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): kotlin.String declared in .FooInterface2 @@ -227,7 +221,6 @@ FILE fqName: fileName:/Main.kt FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = true) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface3 @@ -235,26 +228,26 @@ FILE fqName: fileName:/Main.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface3Impl' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN [val] annotations: Api4J overridden: public open dataBlocking: kotlin.String declared in .FooInterface3 - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN [val] overridden: public open fun (): kotlin.String declared in .FooInterface3 $this: VALUE_PARAMETER name: type:.FooInterface3Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' CALL 'public open fun data (): kotlin.String declared in .FooInterface3Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface3Impl declared in .FooInterface3Impl.' type=.FooInterface3Impl origin=null CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4] @@ -276,7 +269,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface4 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -285,16 +278,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface4Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String annotations: Api4J overridden: @@ -302,18 +295,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface4Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface4 @@ -324,7 +316,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4 @@ -435,46 +426,44 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4 VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' CALL 'public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.data2Blocking' type=.FooInterface4 origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface4.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' CALL 'public abstract fun data (): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.dataBlocking' type=.FooInterface4 origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRudWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4 FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4 VALUE_PARAMETER name:value index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt index 95b1784..c45965c 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt @@ -12,23 +12,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { ^data3 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ (this@R|/FooInterface1Impl|, this@R|/FooInterface1Impl.data3Blocking|).R|/FooInterface1Impl.data3|() + } + ) + } } public abstract interface FooInterface2 : R|kotlin/Any| { @@ -56,23 +71,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { ^data3 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ (this@R|/FooInterface2Impl|, this@R|/FooInterface2Impl.data3Blocking|).R|/FooInterface2Impl.data3|() + } + ) + } } public abstract interface FooInterface3 : R|kotlin/Any| { @@ -89,22 +119,37 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val dataBlocking: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data|() + } + ) + } } public abstract interface FooInterface4 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRudWxs)) public abstract suspend fun data(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=)) public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data|() + } + ) + } } public final class FooInterface4Impl : R|FooInterface4| { @@ -112,16 +157,26 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt index 7b2e294..8df2699 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt @@ -19,7 +19,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface1 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl annotations: Api4J TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false @@ -27,50 +27,49 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface1Impl.data2Blocking): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' CALL 'public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null : $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null value: GET_VAR 'value: A of .FooInterface1Impl.data2Blocking declared in .FooInterface1Impl.data2Blocking' type=A of .FooInterface1Impl.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface1 declared in .FooInterface1 @@ -81,7 +80,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB") JvmSynthetic overridden: public abstract fun data2 (value: A of .FooInterface1.data2): T of .FooInterface1 declared in .FooInterface1 @@ -94,7 +92,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface1 declared in .FooInterface1 @@ -123,56 +120,55 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface2 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' CALL 'public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null value: GET_VAR 'value: T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=T of .FooInterface2Impl origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface2 declared in .FooInterface2 @@ -183,7 +179,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU") JvmSynthetic overridden: public abstract fun data2 (value: T of .FooInterface2): T of .FooInterface2 declared in .FooInterface2 @@ -195,7 +190,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface2 declared in .FooInterface2 @@ -224,7 +218,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface3 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -234,17 +228,17 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3Impl.data2Blocking): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' CALL 'public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null : $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data2Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null value: GET_VAR 'value: A of .FooInterface3Impl.data2Blocking declared in .FooInterface3Impl.data2Blocking' type=A of .FooInterface3Impl.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -253,16 +247,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data3Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -270,18 +264,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.dataBlocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface3 declared in .FooInterface3 @@ -292,7 +285,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB") JvmSynthetic overridden: public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3 @@ -305,7 +297,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3 @@ -334,7 +325,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface4 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -343,16 +334,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' CALL 'public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null value: GET_VAR 'value: T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=T of .FooInterface4Impl origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -361,16 +352,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data3Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -378,18 +369,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface4 declared in .FooInterface4 @@ -400,7 +390,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU") JvmSynthetic overridden: public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 @@ -412,7 +401,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4 @@ -516,7 +504,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 annotations: Api4J TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false @@ -524,56 +512,54 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' CALL 'public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null : $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data2Blocking' type=.FooInterface3.FooInterface3> origin=null value: GET_VAR 'value: A of .FooInterface3.data2Blocking declared in .FooInterface3.data2Blocking' type=A of .FooInterface3.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' CALL 'public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data3Blocking' type=.FooInterface3.FooInterface3> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' CALL 'public abstract fun data (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.dataBlocking' type=.FooInterface3.FooInterface3> origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=") JvmSynthetic TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> @@ -581,7 +567,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> $receiver: VALUE_PARAMETER name: type:kotlin.Int @@ -601,69 +586,66 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' CALL 'public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data2Blocking' type=.FooInterface4.FooInterface4> origin=null value: GET_VAR 'value: T of .FooInterface4 declared in .FooInterface4.data2Blocking' type=T of .FooInterface4 origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' CALL 'public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data3Blocking' type=.FooInterface4.FooInterface4> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' CALL 'public abstract fun data (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.dataBlocking' type=.FooInterface4.FooInterface4> origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> $receiver: VALUE_PARAMETER name: type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt index 50347f6..e01f208 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt @@ -16,23 +16,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|A|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface1Impl|, this@R|/FooInterface1Impl.data3Blocking|).R|/FooInterface1Impl.data3|() + } + ) + } } public abstract interface FooInterface2 : R|kotlin/Any| { @@ -48,37 +63,67 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|T|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface2Impl|, this@R|/FooInterface2Impl.data3Blocking|).R|/FooInterface2Impl.data3|() + } + ) + } } public abstract interface FooInterface3 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs)) public abstract suspend fun data(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=)) public abstract suspend fun data2(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|A|): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun R|kotlin/Int|.data3(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3|.R|/FooInterface3.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3|.R|/FooInterface3.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface3|, this@R|/FooInterface3.data3Blocking|).R|/FooInterface3.data3|() + } + ) + } } public final class FooInterface3Impl : R|FooInterface3| { @@ -86,37 +131,67 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|A|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface3Impl|, this@R|/FooInterface3Impl.data3Blocking|).R|/FooInterface3Impl.data3|() + } + ) + } } public abstract interface FooInterface4 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs)) public abstract suspend fun data(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=)) public abstract suspend fun data2(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|T|): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun R|kotlin/Int|.data3(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface4|, this@R|/FooInterface4.data3Blocking|).R|/FooInterface4.data3|() + } + ) + } } public final class FooInterface4Impl : R|FooInterface4| { @@ -124,22 +199,37 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|T|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface4Impl|, this@R|/FooInterface4Impl.data3Blocking|).R|/FooInterface4Impl.data3|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt index 9156a3a..4503f49 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt @@ -70,7 +70,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture annotations: Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) Api4J @@ -79,25 +79,27 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun runAsync (): java.util.concurrent.CompletableFuture declared in .OptInTest' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .OptInTest.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runAsync' CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null $this: GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int annotations: Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) Api4J $this: VALUE_PARAMETER name: type:.OptInTest BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun runBlocking (): kotlin.Int declared in .OptInTest' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null $this: GET_VAR ': .OptInTest declared in .OptInTest.runBlocking' type=.OptInTest origin=null FUN name:run visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] @@ -106,7 +108,6 @@ FILE fqName: fileName:/Main.kt Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuT3B0SW5UZXN0bnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.OptInTest BLOCK_BODY diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt index 5a12831..c7b9695 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt @@ -23,12 +23,22 @@ FILE: Main.kt ^run0 Int(1) } - @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuT3B0SW5UZXN0bnVsbA==)) public final suspend fun run(): R|kotlin/Int| { + @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun run(): R|kotlin/Int| { ^run this@R|/OptInTest|.R|/OptInTest.run0|() } - @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/OptInTest|.R|/OptInTest.run|() + } + , (this@R|/OptInTest| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/OptInTest|.R|/OptInTest.run|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt index dcd2dec..91e889a 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt @@ -134,7 +134,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .IFoo $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo @@ -142,31 +142,32 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runAsync' CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=.Bar origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:.Bar [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuRm9vbnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo, n:kotlin.Int) returnType:.Bar [suspend] @@ -198,7 +199,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.IFoo @@ -207,32 +208,33 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runAsync' CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar annotations: Api4J $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=.Bar origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] annotations: - TargetMarker(value = "cnVuSUZvb251bGxrb3RsaW4vSW50") JvmSynthetic $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt index 16a577c..90a83b0 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt @@ -1,14 +1,24 @@ FILE: Main.kt @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract interface IFoo : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuSUZvb251bGxrb3RsaW4vSW50)) public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| + @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|Bar| { + ^ this@R|/IFoo|.R|/IFoo.run|(R|/n|) + } + , (this@R|/IFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|Bar| { + ^ this@R|/IFoo|.R|/IFoo.run|(R|/n|) + } + ) + } } public abstract interface Foo : R|IFoo| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vbnVsbA==)) public abstract suspend fun run(): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(): R|Bar| public open suspend fun run(name: R|kotlin/String|): R|Tar| { ^run R|/Tar.Tar|() @@ -16,9 +26,19 @@ FILE: Main.kt public abstract override suspend fun run(n: R|kotlin/Int|): R|Bar| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|Bar| { + ^ this@R|/Foo|.R|/Foo.run|() + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|Bar| { + ^ this@R|/Foo|.R|/Foo.run|() + } + ) + } } public final class FooImpl : R|Foo| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt index b9e8fdf..b97041d 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt @@ -136,7 +136,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture annotations: Api4J TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false @@ -146,15 +146,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.run> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.run [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.run declared in .Foo.runAsync' CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null : $this: GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null api: GET_VAR 'api: .Api.Foo.runAsync> declared in .Foo.runAsync' type=.Api.Foo.runAsync> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking annotations: Api4J TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false @@ -162,17 +164,17 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:api index:0 type:.Api.Foo.runBlocking> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=R of .Foo.run origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.runBlocking> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.runBlocking [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.run> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.run [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.runBlocking declared in .Foo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.run declared in .Foo.runBlocking' CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null : $this: GET_VAR ': .Foo.Foo> declared in .Foo.runBlocking' type=.Foo.Foo> origin=null api: GET_VAR 'api: .Api.Foo.runBlocking> declared in .Foo.runBlocking' type=.Api.Foo.runBlocking> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo.Foo> @@ -180,31 +182,32 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueAsync' CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo.Foo> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .Foo origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null FUN name:run visibility:public modality:ABSTRACT ($this:.Foo.Foo>, api:.Api.Foo.run>) returnType:R of .Foo.run [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuRm9vPFQ+bnVsbEFwaTxSPg==") JvmSynthetic TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false $this: VALUE_PARAMETER name: type:.Foo.Foo> @@ -213,6 +216,5 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "dmFsdWVGb288VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo.Foo> diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt index cc5bfb9..7ace09f 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt @@ -18,17 +18,37 @@ FILE: Main.kt } public abstract interface Foo : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(dmFsdWVGb288VD5udWxs)) public abstract suspend fun value(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun value(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vPFQ+bnVsbEFwaTxSPg==)) public abstract suspend fun run(api: R|Api|): R|R| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(api: R|Api|): R|R| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| { + ^valueAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|T| { + ^ this@R|/Foo|.R|/Foo.value|() + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| { + ^valueBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/Foo|.R|/Foo.value|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|R| { + ^ this@R|/Foo|.R|/Foo.run|(R|/api|) + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|R| { + ^ this@R|/Foo|.R|/Foo.run|(R|/api|) + } + ) + } } public final class FooImpl : R|Foo| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt new file mode 100644 index 0000000..437a7ce --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt @@ -0,0 +1,35 @@ +public abstract interface Api : java/lang/Object { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) +} + +public final class ApiExecutable$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture executeAsync(ApiExecutable $this, Api api) +} + +final class ApiExecutable$executeAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final ApiExecutable this$0 + + void (ApiExecutable $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface ApiExecutable : java/lang/Object { + public abstract java.lang.Object execute(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture executeAsync(Api p0) +} + +public abstract interface ApiResult : java/lang/Object { + +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt new file mode 100644 index 0000000..e4c911c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt @@ -0,0 +1,77 @@ +FILE fqName: fileName:/Main.kt + CLASS INTERFACE name:Api modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Api.Api>) returnType:T of .Api [suspend] + $this: VALUE_PARAMETER name: type:.Api.Api> + CLASS INTERFACE name:ApiExecutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiExecutable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:executeAsync visibility:public modality:OPEN ($this:.ApiExecutable, api:.Api.ApiExecutable.executeAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.executeAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun executeAsync (api: .Api.ApiExecutable.executeAsync>): java.util.concurrent.CompletableFuture declared in .ApiExecutable' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.ApiResult<.Api.ApiExecutable.execute>>> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable.executeAsync' + CALL 'public abstract fun execute (api: .Api.ApiExecutable.execute>): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable' type=.ApiResult<.Api.ApiExecutable.execute>> origin=null + : + $this: GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + api: GET_VAR 'api: .Api.ApiExecutable.executeAsync> declared in .ApiExecutable.executeAsync' type=.Api.ApiExecutable.executeAsync> origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + FUN name:execute visibility:public modality:ABSTRACT ($this:.ApiExecutable, api:.Api.ApiExecutable.execute>) returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.execute> + CLASS INTERFACE name:ApiResult modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiResult.ApiResult> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt new file mode 100644 index 0000000..4f7116b --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt @@ -0,0 +1,18 @@ +FILE: Main.kt + public abstract interface Api : R|kotlin/Any| { + public abstract suspend fun run(): R|T| + + } + public abstract interface ApiResult : R|kotlin/Any| { + } + public abstract interface ApiExecutable : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun execute(api: R|Api|): R|ApiResult>| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun executeAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture>>| { + ^executeAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|ApiResult>| { + ^ this@R|/ApiExecutable|.R|/ApiExecutable.execute|(R|/api|) + } + , (this@R|/ApiExecutable| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt new file mode 100644 index 0000000..39afb79 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt @@ -0,0 +1,17 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +interface Api { + suspend fun run(): T +} + +interface ApiResult + +interface ApiExecutable { + @JvmAsync + suspend fun execute(api: Api): ApiResult> +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt new file mode 100644 index 0000000..6035411 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt @@ -0,0 +1,47 @@ +final class MyClass$deleteAllAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$deleteAllBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract class MyClass : java/lang/Object { + public void () + + public java.lang.Object deleteAll(int option, kotlin.coroutines.Continuation $completion) + + static java.lang.Object deleteAll$suspendImpl(MyClass $this, int option, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture deleteAllAsync(int option) + + public int deleteAllBlocking(int option) +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt new file mode 100644 index 0000000..029b1a9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:deleteAllAsync visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllAsync (option: kotlin.Int): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllAsync' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllAsync' type=kotlin.Int origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:deleteAllBlocking visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllBlocking (option: kotlin.Int): kotlin.Int declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllBlocking' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllBlocking' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllBlocking' type=kotlin.Int origin=null + FUN name:deleteAll visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt new file mode 100644 index 0000000..c2ab915 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt @@ -0,0 +1,25 @@ +FILE: Main.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public open suspend fun deleteAll(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAll Int(1) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllAsync(option: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^deleteAllAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllBlocking(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAllBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + ) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt new file mode 100644 index 0000000..951b4c3 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt @@ -0,0 +1,49 @@ +public final class MainKt : java/lang/Object { + +} + +final class MyClass$errorReproductionAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final long $amount + + int label + + final MyClass this$0 + + void (MyClass $receiver, long $amount, kotlin.coroutines.Continuation p2) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$errorReproductionBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final long $amount + + int label + + final MyClass this$0 + + void (MyClass $receiver, long $amount, kotlin.coroutines.Continuation p2) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class MyClass : java/lang/Object { + public void () + + public final java.lang.Object errorReproduction(long amount, kotlin.coroutines.Continuation p1) + + public final java.util.concurrent.CompletableFuture errorReproductionAsync(long amount) + + public final void errorReproductionBlocking(long amount) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt new file mode 100644 index 0000000..dd3bc1b --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun errorReproductionAsync (amount: kotlin.Long): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .MyClass.errorReproductionAsync' + CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null + amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionAsync' type=kotlin.Long origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun errorReproductionBlocking (amount: kotlin.Long): kotlin.Unit declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' + CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionBlocking' type=.MyClass origin=null + amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionBlocking' type=kotlin.Long origin=null + FUN name:errorReproduction visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + CALL 'public final fun println (message: kotlin.Long): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null + message: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproduction' type=kotlin.Long origin=null + TYPEALIAS name:MoneyValue visibility:public expandedType:kotlin.Long diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt new file mode 100644 index 0000000..dee753c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt @@ -0,0 +1,16 @@ +FILE: Main.kt + public final typealias MoneyValue = R|kotlin/Long| + public final class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=)) public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + R|kotlin/io/println|(R|/amount|) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt new file mode 100644 index 0000000..ed0adc2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt @@ -0,0 +1,16 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +typealias MoneyValue = Long + +class MyClass { + @JvmBlocking + @JvmAsync + suspend fun errorReproduction(amount: MoneyValue) { println(amount) } +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt new file mode 100644 index 0000000..f3395d3 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt @@ -0,0 +1,141 @@ +public final class IProp$DefaultImpls : java/lang/Object { + public static java.lang.String getProp(IProp $this) + + public static void getProp$annotations() + + public static java.util.concurrent.CompletableFuture getPropAsync(IProp $this) + + public static void getPropAsync$annotations() +} + +final class IProp$prop$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final IProp this$0 + + void (IProp $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class IProp$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final IProp this$0 + + void (IProp $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface IProp : java/lang/Object { + public abstract java.lang.String getProp() + + public abstract java.util.concurrent.CompletableFuture getPropAsync() + + public abstract java.lang.Object prop(kotlin.coroutines.Continuation p0) +} + +final class PropFoo$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropFoo : java/lang/Object { + public void () + + public final java.lang.String getProp() + + public static void getProp$annotations() + + public final java.util.concurrent.CompletableFuture getPropAsync() + + public static void getPropAsync$annotations() + + public final java.lang.Object prop(kotlin.coroutines.Continuation $completion) +} + +final class PropImpl$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropImpl$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropImpl : java/lang/Object, IProp { + public void () + + public java.lang.String getProp() + + public static void getProp$annotations() + + public java.util.concurrent.CompletableFuture getPropAsync() + + public static void getPropAsync$annotations() + + public java.lang.Object prop(kotlin.coroutines.Continuation $completion) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt new file mode 100644 index 0000000..94fc8b0 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt @@ -0,0 +1,199 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropFoo + CONSTRUCTOR visibility:public <> () returnType:.PropFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcFByb3BGb29udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .PropFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropImpl + CONSTRUCTOR visibility:public <> () returnType:.PropImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcFByb3BJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun prop (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun prop (): kotlin.String declared in .PropImpl' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open prop: kotlin.String declared in .IProp + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .PropImpl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open propAsync: java.util.concurrent.CompletableFuture declared in .IProp + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + overridden: + public open fun (): java.util.concurrent.CompletableFuture declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .PropImpl' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + CLASS INTERFACE name:IProp modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IProp + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:ABSTRACT <> ($this:.IProp) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcElQcm9wbnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IProp + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .IProp' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .IProp' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt new file mode 100644 index 0000000..8e4a88a --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt @@ -0,0 +1,43 @@ +FILE: Main.kt + public final class PropFoo : R|kotlin/Any| { + public constructor(): R|PropFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BGb29udWxs)) public final suspend fun prop(): R|kotlin/String| { + ^prop String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public abstract interface IProp : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcElQcm9wbnVsbA==)) public abstract suspend fun prop(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public final class PropImpl : R|IProp| { + public constructor(): R|PropImpl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BJbXBsbnVsbA==)) public open override suspend fun prop(): R|kotlin/String| { + ^prop String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt new file mode 100644 index 0000000..76013dc --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt @@ -0,0 +1,27 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +class PropFoo { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + suspend fun prop(): String = "" +} + + +interface IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + suspend fun prop(): String +} + +class PropImpl : IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + override suspend fun prop(): String = "" +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt new file mode 100644 index 0000000..ff786c2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt @@ -0,0 +1,125 @@ +final class BasicBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final BasicBar this$0 + + void (BasicBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class BasicBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicBar this$0 + + void (BasicBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicBar : java/lang/Object { + public void () + + public final java.lang.Object bar(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object bar2(int i, kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture bar2Async(int i) + + public final java.util.concurrent.CompletableFuture barAsync() +} + +final class BasicFoo$fooAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicFoo this$0 + + void (BasicFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicFoo : java/lang/Object { + public void () + + public final java.lang.Object foo(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture fooAsync() +} + +public final class InterfaceBar$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture bar2Async(InterfaceBar $this, int i) + + public static java.util.concurrent.CompletableFuture barAsync(InterfaceBar $this) +} + +final class InterfaceBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class InterfaceBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface InterfaceBar : java/lang/Object { + public abstract ResultValue asyncBase(int p0) + + public abstract java.lang.Object bar(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object bar2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture bar2Async(int p0) + + public abstract java.util.concurrent.CompletableFuture barAsync() +} + +public final class ResultValue : java/lang/Object { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt new file mode 100644 index 0000000..e81cdb2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt @@ -0,0 +1,192 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicBar + CONSTRUCTOR visibility:public <> () returnType:.BasicBar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' + CALL 'public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' type=kotlin.String origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' + CALL 'public final fun bar (): kotlin.String declared in .BasicBar' type=kotlin.String origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null + FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyQmFzaWNCYXJudWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar (): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar" + FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar2" + CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicFoo + CONSTRUCTOR visibility:public <> () returnType:.BasicFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' + CALL 'public final fun foo (): kotlin.String declared in .BasicFoo' type=kotlin.String origin=null + $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null + FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "Zm9vQmFzaWNGb29udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in .BasicFoo' + CONST String type=kotlin.String value="foo" + CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ResultValue.ResultValue> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.ResultValue.ResultValue> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:InterfaceBar modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.InterfaceBar + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' + CALL 'public abstract fun bar2 (i: kotlin.Int): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.InterfaceBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' + CALL 'public abstract fun bar (): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null + FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFySW50ZXJmYWNlQmFybnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt new file mode 100644 index 0000000..ca0b8f6 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt @@ -0,0 +1,49 @@ +FILE: Main.kt + public final class BasicFoo : R|kotlin/Any| { + public constructor(): R|BasicFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(Zm9vQmFzaWNGb29udWxs)) public final suspend fun foo(): R|kotlin/String| { + ^foo String(foo) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class BasicBar : R|kotlin/Any| { + public constructor(): R|BasicBar| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyQmFzaWNCYXJudWxs)) public final suspend fun bar(): R|kotlin/String| { + ^bar String(bar) + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=)) public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { + ^bar2 String(bar2) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public abstract interface InterfaceBar : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFySW50ZXJmYWNlQmFybnVsbA==)) public abstract suspend fun bar(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50)) public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| + + public abstract fun asyncBase(i: R|kotlin/Int|): R|ResultValue| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class ResultValue : R|kotlin/Any| { + public constructor(): R|ResultValue| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt new file mode 100644 index 0000000..8e72785 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt @@ -0,0 +1,30 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +class BasicFoo { + @JvmAsync + suspend fun foo(): String = "foo" +} + +class BasicBar { + @JvmAsync + suspend fun bar(): String = "bar" + @JvmAsync + suspend fun bar2(i: Int): String = "bar2" +} + +interface InterfaceBar { + @JvmAsync + suspend fun bar(): String + @JvmAsync + suspend fun bar2(i: Int): String + + fun asyncBase(i: Int): ResultValue +} + +class ResultValue diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt new file mode 100644 index 0000000..b161c51 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt @@ -0,0 +1,297 @@ +public abstract interface FooInterface1 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface1Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface1Impl : java/lang/Object, FooInterface1 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public java.lang.String data3Blocking(int $this$data3Blocking) + + public java.lang.String dataBlocking() +} + +public final class FooInterface2$DefaultImpls : java/lang/Object { + public static java.lang.String data2Blocking(FooInterface2 $this, int value) + + public static java.lang.String data3Blocking(FooInterface2 $this, int $receiver) + + public static java.lang.String dataBlocking(FooInterface2 $this) +} + +public abstract interface FooInterface2 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data2Blocking(int p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data3Blocking(int p0) + + public abstract java.lang.String dataBlocking() +} + +final class FooInterface2Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface2Impl : java/lang/Object, FooInterface2 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public java.lang.String data3Blocking(int $this$data3Blocking) + + public java.lang.String dataBlocking() +} + +public final class FooInterface3$DefaultImpls : java/lang/Object { + public static java.lang.String getDataBlocking(FooInterface3 $this) +} + +public abstract interface FooInterface3 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.String getDataBlocking() +} + +final class FooInterface3Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface3Impl : java/lang/Object, FooInterface3 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.String getDataBlocking() + + public static void getDataBlocking$annotations() +} + +public final class FooInterface4$DefaultImpls : java/lang/Object { + public static java.lang.String data2Blocking(FooInterface4 $this, int value) + + public static java.lang.String dataBlocking(FooInterface4 $this) +} + +final class FooInterface4$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface4 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data2Blocking(int p0) + + public abstract java.lang.String dataBlocking() +} + +final class FooInterface4Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface4Impl : java/lang/Object, FooInterface4 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.String dataBlocking() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt new file mode 100644 index 0000000..2dae78c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt @@ -0,0 +1,480 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface1Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface1Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' + CALL 'public open fun data3 (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface2Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface2Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data3Blocking (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' + CALL 'public open fun data3 (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun dataBlocking (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface3Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = true) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface3Impl' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open dataBlocking: kotlin.String declared in .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' + CALL 'public open fun data (): kotlin.String declared in .FooInterface3Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface3Impl declared in .FooInterface3Impl.' type=.FooInterface3Impl origin=null + CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface4Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface4Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun dataBlocking (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface4Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface1) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface1, value:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface1, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface2) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface2, value:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + FUN name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2, value:kotlin.Int) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface2, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + FUN name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2, $receiver:kotlin.Int) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + FUN name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface3 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface3 + PROPERTY name:dataBlocking visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.FooInterface3) returnType:kotlin.String + correspondingProperty: PROPERTY name:dataBlocking visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.FooInterface3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface4 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' + CALL 'public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.data2Blocking' type=.FooInterface4 origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface4.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' + CALL 'public abstract fun data (): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.dataBlocking' type=.FooInterface4 origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRudWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4 + VALUE_PARAMETER name:value index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt new file mode 100644 index 0000000..95b1784 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt @@ -0,0 +1,127 @@ +FILE: Main.kt + public abstract interface FooInterface1 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + public abstract suspend fun R|kotlin/Int|.data3(): R|kotlin/String| + + } + public final class FooInterface1Impl : R|FooInterface1| { + public constructor(): R|FooInterface1Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + ^data3 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + + } + public abstract interface FooInterface2 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking String() + } + + public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking String() + } + + public abstract suspend fun R|kotlin/Int|.data3(): R|kotlin/String| + + public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking String() + } + + } + public final class FooInterface2Impl : R|FooInterface2| { + public constructor(): R|FooInterface2Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + ^data3 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + + } + public abstract interface FooInterface3 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public open val dataBlocking: R|kotlin/String| + public get(): R|kotlin/String| { + ^ String() + } + + } + public final class FooInterface3Impl : R|FooInterface3| { + public constructor(): R|FooInterface3Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val dataBlocking: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public abstract interface FooInterface4 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRudWxs)) public abstract suspend fun data(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=)) public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + + } + public final class FooInterface4Impl : R|FooInterface4| { + public constructor(): R|FooInterface4Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt new file mode 100644 index 0000000..5a915d0 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt @@ -0,0 +1,74 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync + +interface FooInterface1 { + suspend fun data(): String + suspend fun data2(value: Int): String + suspend fun Int.data3(): String +} + +class FooInterface1Impl : FooInterface1 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): String = "" +} + +interface FooInterface2 { + suspend fun data(): String + fun dataBlocking(): String = "" + + suspend fun data2(value: Int): String + fun data2Blocking(value: Int): String = "" + + suspend fun Int.data3(): String + fun Int.data3Blocking(): String = "" +} + +class FooInterface2Impl : FooInterface2 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): String = "" +} + + +interface FooInterface3 { + suspend fun data(): String + val dataBlocking: String get() = "" +} + +class FooInterface3Impl : FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true) + override suspend fun data(): String = "" +} + +interface FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): String + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: Int): String +} + +class FooInterface4Impl : FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt new file mode 100644 index 0000000..2429b42 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt @@ -0,0 +1,449 @@ +public abstract interface Bar : java/lang/Object, Foo { + +} + +public abstract interface Foo : java/lang/Object { + +} + +public abstract interface FooInterface1 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(java.lang.Object p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface1Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface1Impl : java/lang/Object, FooInterface1 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(java.lang.Object value, kotlin.coroutines.Continuation $completion) + + public Bar data2Blocking(java.lang.Object value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Bar data3Blocking(int $this$data3Blocking) + + public Bar dataBlocking() +} + +public abstract interface FooInterface2 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(Foo p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface2Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface2Impl : java/lang/Object, FooInterface2 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(Foo value, kotlin.coroutines.Continuation $completion) + + public Foo data2Blocking(Foo value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Foo data3Blocking(int $this$data3Blocking) + + public Foo dataBlocking() +} + +public final class FooInterface3$DefaultImpls : java/lang/Object { + public static Foo data2Blocking(FooInterface3 $this, java.lang.Object value) + + public static Foo data3Blocking(FooInterface3 $this, int $receiver) + + public static Foo dataBlocking(FooInterface3 $this) +} + +final class FooInterface3$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface3 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(java.lang.Object p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data2Blocking(java.lang.Object p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data3Blocking(int p0) + + public abstract Foo dataBlocking() +} + +final class FooInterface3Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface3Impl : java/lang/Object, FooInterface3 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(java.lang.Object value, kotlin.coroutines.Continuation $completion) + + public Bar data2Blocking(java.lang.Object value) + + public Foo data2Blocking(java.lang.Object value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Bar data3Blocking(int $this$data3Blocking) + + public Foo data3Blocking(int $this$data3Blocking) + + public Bar dataBlocking() + + public Foo dataBlocking() +} + +public final class FooInterface4$DefaultImpls : java/lang/Object { + public static Foo data2Blocking(FooInterface4 $this, Foo value) + + public static Foo data3Blocking(FooInterface4 $this, int $receiver) + + public static Foo dataBlocking(FooInterface4 $this) +} + +final class FooInterface4$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface4 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(Foo p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data2Blocking(Foo p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data3Blocking(int p0) + + public abstract Foo dataBlocking() +} + +final class FooInterface4Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface4Impl : java/lang/Object, FooInterface4 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(Foo value, kotlin.coroutines.Continuation $completion) + + public Foo data2Blocking(Foo value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Foo data3Blocking(int $this$data3Blocking) + + public Foo dataBlocking() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt new file mode 100644 index 0000000..7b2e294 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt @@ -0,0 +1,669 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1.FooInterface1Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1Impl.FooInterface1Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Bar] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface1Impl.FooInterface1Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1.FooInterface1Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl + annotations: + Api4J + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface1Impl.data2Blocking): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' + CALL 'public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + : + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + value: GET_VAR 'value: A of .FooInterface1Impl.data2Blocking declared in .FooInterface1Impl.data2Blocking' type=A of .FooInterface1Impl.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface1 declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB") + JvmSynthetic + overridden: + public abstract fun data2 (value: A of .FooInterface1.data2): T of .FooInterface1 declared in .FooInterface1 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface1 declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2.FooInterface2Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2Impl.FooInterface2Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface2Impl.FooInterface2Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2.FooInterface2Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' + CALL 'public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + value: GET_VAR 'value: T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=T of .FooInterface2Impl origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU") + JvmSynthetic + overridden: + public abstract fun data2 (value: T of .FooInterface2): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3.FooInterface3Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3Impl.FooInterface3Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Bar] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface3Impl.FooInterface3Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3.FooInterface3Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3Impl.data2Blocking): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' + CALL 'public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + : + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data2Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + value: GET_VAR 'value: A of .FooInterface3Impl.data2Blocking declared in .FooInterface3Impl.data2Blocking' type=A of .FooInterface3Impl.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data3Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.dataBlocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB") + JvmSynthetic + overridden: + public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4.FooInterface4Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4Impl.FooInterface4Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface4Impl.FooInterface4Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4.FooInterface4Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' + CALL 'public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + value: GET_VAR 'value: T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=T of .FooInterface4Impl origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data3Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU") + JvmSynthetic + overridden: + public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS INTERFACE name:Bar modality:ABSTRACT visibility:public superTypes:[.Foo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:FooInterface1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1.FooInterface1> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface1.FooInterface1>) returnType:T of .FooInterface1 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface1.FooInterface1>, value:A of .FooInterface1.data2) returnType:T of .FooInterface1 [suspend] + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1.data2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface1.FooInterface1>, $receiver:kotlin.Int) returnType:T of .FooInterface1 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2.FooInterface2> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>, value:T of .FooInterface2) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>, $receiver:kotlin.Int) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface3 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3.FooInterface3> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 + annotations: + Api4J + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' + CALL 'public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + : + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data2Blocking' type=.FooInterface3.FooInterface3> origin=null + value: GET_VAR 'value: A of .FooInterface3.data2Blocking declared in .FooInterface3.data2Blocking' type=A of .FooInterface3.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' + CALL 'public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data3Blocking' type=.FooInterface3.FooInterface3> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' + CALL 'public abstract fun data (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.dataBlocking' type=.FooInterface3.FooInterface3> origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=") + JvmSynthetic + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface4 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4.FooInterface4> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' + CALL 'public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data2Blocking' type=.FooInterface4.FooInterface4> origin=null + value: GET_VAR 'value: T of .FooInterface4 declared in .FooInterface4.data2Blocking' type=T of .FooInterface4 origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' + CALL 'public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data3Blocking' type=.FooInterface4.FooInterface4> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' + CALL 'public abstract fun data (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.dataBlocking' type=.FooInterface4.FooInterface4> origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + $receiver: VALUE_PARAMETER name: type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt new file mode 100644 index 0000000..50347f6 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt @@ -0,0 +1,145 @@ +FILE: Main.kt + public abstract interface Foo : R|kotlin/Any| { + } + public abstract interface Bar : R|Foo| { + } + public abstract interface FooInterface1 : R|kotlin/Any| { + public abstract suspend fun data(): R|T| + + public abstract suspend fun data2(value: R|A|): R|T| + + public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + } + public final class FooInterface1Impl : R|FooInterface1| { + public constructor(): R|FooInterface1Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface2 : R|kotlin/Any| { + public abstract suspend fun data(): R|T| + + public abstract suspend fun data2(value: R|T|): R|T| + + public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + } + public final class FooInterface2Impl : R|FooInterface2| { + public constructor(): R|FooInterface2Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface3 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs)) public abstract suspend fun data(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=)) public abstract suspend fun data2(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public final class FooInterface3Impl : R|FooInterface3| { + public constructor(): R|FooInterface3Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface4 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs)) public abstract suspend fun data(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=)) public abstract suspend fun data2(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public final class FooInterface4Impl : R|FooInterface4| { + public constructor(): R|FooInterface4Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt new file mode 100644 index 0000000..e2c1e26 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt @@ -0,0 +1,83 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +interface Foo +interface Bar : Foo + + +interface FooInterface1 { + suspend fun data(): T + suspend fun data2(value: A): T + suspend fun Int.data3(): T +} + +class FooInterface1Impl : FooInterface1 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: A): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface2 { + suspend fun data(): T + suspend fun data2(value: T): T + suspend fun Int.data3(): T +} + +class FooInterface2Impl : FooInterface2 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: T): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: A): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun Int.data3(): T +} + +class FooInterface3Impl : FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: A): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: T): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun Int.data3(): T +} + +class FooInterface4Impl : FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: T): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt new file mode 100644 index 0000000..153e73d --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt @@ -0,0 +1,53 @@ +public abstract interface OneOptAnno : java/lang/Object, java/lang/annotation/Annotation { + +} + +final class OptInTest$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final OptInTest this$0 + + void (OptInTest $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class OptInTest$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final OptInTest this$0 + + void (OptInTest $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class OptInTest : java/lang/Object { + public void () + + public final static java.lang.Object access$run0(OptInTest $this, kotlin.coroutines.Continuation $completion) + + public final java.lang.Object run(kotlin.coroutines.Continuation $completion) + + private final java.lang.Object run0(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture runAsync() + + public final int runBlocking() +} + +public abstract interface Values : java/lang/Object, java/lang/annotation/Annotation { + public abstract java.lang.Class target() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt new file mode 100644 index 0000000..9156a3a --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt @@ -0,0 +1,122 @@ +FILE fqName: fileName:/Main.kt + CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + RequiresOptIn(message = , level = GET_ENUM 'ENUM_ENTRY name:ERROR' type=kotlin.RequiresOptIn.Level) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.OneOptAnno + CONSTRUCTOR visibility:public <> () returnType:.OneOptAnno [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Values modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Values + PROPERTY name:target visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:target type:kotlin.reflect.KClass<*> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'target: kotlin.reflect.KClass<*> declared in .Values.' type=kotlin.reflect.KClass<*> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Values) returnType:kotlin.reflect.KClass<*> + correspondingProperty: PROPERTY name:target visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Values + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass<*> declared in .Values' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:target type:kotlin.reflect.KClass<*> visibility:private [final]' type=kotlin.reflect.KClass<*> origin=null + receiver: GET_VAR ': .Values declared in .Values.' type=.Values origin=null + CONSTRUCTOR visibility:public <> (target:kotlin.reflect.KClass<*>) returnType:.Values [primary] + VALUE_PARAMETER name:target index:0 type:kotlin.reflect.KClass<*> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Values modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.OptInTest + CONSTRUCTOR visibility:public <> () returnType:.OptInTest [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture + annotations: + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + Api4J + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun runAsync (): java.util.concurrent.CompletableFuture declared in .OptInTest' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .OptInTest.runAsync' + CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int + annotations: + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + Api4J + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun runBlocking (): kotlin.Int declared in .OptInTest' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' + CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.runBlocking' type=.OptInTest origin=null + FUN name:run visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] + annotations: + OptIn(markerClass = [CLASS_REFERENCE 'CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.OneOptAnno>] type=kotlin.Array> varargElementType=kotlin.reflect.KClass) + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuT3B0SW5UZXN0bnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun run (): kotlin.Int declared in .OptInTest' + CALL 'private final fun run0 (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.run' type=.OptInTest origin=null + FUN name:run0 visibility:private modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] + annotations: + OneOptAnno + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun run0 (): kotlin.Int declared in .OptInTest' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt new file mode 100644 index 0000000..5a12831 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt @@ -0,0 +1,34 @@ +FILE: Main.kt + @R|kotlin/RequiresOptIn|(level = Q|kotlin/RequiresOptIn.Level|.R|kotlin/RequiresOptIn.Level.ERROR|) public final annotation class OneOptAnno : R|kotlin/Annotation| { + public constructor(): R|OneOptAnno| { + super() + } + + } + public final annotation class Values : R|kotlin/Annotation| { + public constructor(target: R|kotlin/reflect/KClass<*>|): R|Values| { + super() + } + + public final val target: R|kotlin/reflect/KClass<*>| = R|/target| + public get(): R|kotlin/reflect/KClass<*>| + + } + public final class OptInTest : R|kotlin/Any| { + public constructor(): R|OptInTest| { + super() + } + + @R|OneOptAnno|() private final suspend fun run0(): R|kotlin/Int| { + ^run0 Int(1) + } + + @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuT3B0SW5UZXN0bnVsbA==)) public final suspend fun run(): R|kotlin/Int| { + ^run this@R|/OptInTest|.R|/OptInTest.run0|() + } + + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| + + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt new file mode 100644 index 0000000..8278602 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt @@ -0,0 +1,27 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.suspendCancellableCoroutine +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +import kotlin.annotation.AnnotationRetention.SOURCE +import kotlin.coroutines.resume +import kotlin.reflect.KClass + +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) +annotation class OneOptAnno + +annotation class Values(val target: KClass<*>) + +class OptInTest { + @OneOptAnno + private suspend fun run0() = 1 + + @OptIn(OneOptAnno::class) + @Values(OptInTest::class) + @JvmBlocking + @JvmAsync + suspend fun run(): Int = run0() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt new file mode 100644 index 0000000..bdc9c08 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt @@ -0,0 +1,131 @@ +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.lang.Object run(Foo $this, java.lang.String name, kotlin.coroutines.Continuation $completion) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this, int n) + + public static Bar runBlocking(Foo $this) + + public static Bar runBlocking(Foo $this, int n) +} + +final class Foo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object, IFoo { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object run(java.lang.String p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync() + + public abstract Bar runBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object run(kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(java.lang.String name, kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(int n, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture runAsync() + + public java.util.concurrent.CompletableFuture runAsync(int n) + + public Bar runBlocking() + + public Bar runBlocking(int n) +} + +public final class IFoo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture runAsync(IFoo $this, int n) + + public static Bar runBlocking(IFoo $this, int n) +} + +final class IFoo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class IFoo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface IFoo : java/lang/Object { + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync(int p0) + + public abstract Bar runBlocking(int p0) +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt new file mode 100644 index 0000000..dcd2dec --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt @@ -0,0 +1,238 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun run (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (n: kotlin.Int): .Bar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, name:kotlin.String) returnType:.Tar [suspend] + overridden: + public open fun run (name: kotlin.String): .Tar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[.IFoo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null + $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null + $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:.Bar [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuRm9vbnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN name:run visibility:public modality:OPEN <> ($this:.Foo, name:kotlin.String) returnType:.Tar [suspend] + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .Foo' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null + FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] + annotations: + TargetMarker(value = "cnVuSUZvb251bGxrb3RsaW4vSW50") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt new file mode 100644 index 0000000..16a577c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt @@ -0,0 +1,53 @@ +FILE: Main.kt + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract interface IFoo : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuSUZvb251bGxrb3RsaW4vSW50)) public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| + + } + public abstract interface Foo : R|IFoo| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vbnVsbA==)) public abstract suspend fun run(): R|Bar| + + public open suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public abstract override suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun run(): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(n: R|kotlin/Int|): R|Bar| { + ^run R|/Tar.Tar|() + } + + } + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt new file mode 100644 index 0000000..aa0e5b2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt @@ -0,0 +1,29 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +@JvmBlocking +@JvmAsync +interface IFoo { + suspend fun run(n: Int): Bar +} + +interface Foo : IFoo { + @JvmBlocking + @JvmAsync + suspend fun run(): Bar + suspend fun run(name:String): Tar = Tar() + override suspend fun run(n: Int): Bar +} + +class FooImpl : Foo { + override suspend fun run(): Tar = Tar() + override suspend fun run(name:String): Tar = Tar() + override suspend fun run(n: Int): Bar = Tar() +} + +open class Bar +class Tar : Bar() diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt new file mode 100644 index 0000000..465ee38 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt @@ -0,0 +1,121 @@ +public final class Api : java/lang/Object { + public void () +} + +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture runAsync(Foo $this, Api api) + + public static java.lang.Object runBlocking(Foo $this, Api api) + + public static java.util.concurrent.CompletableFuture valueAsync(Foo $this) + + public static Bar valueBlocking(Foo $this) +} + +final class Foo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final Foo this$0 + + void (Foo $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final Foo this$0 + + void (Foo $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$valueAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$valueBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object { + public abstract java.lang.Object run(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync(Api p0) + + public abstract java.lang.Object runBlocking(Api p0) + + public abstract java.lang.Object value(kotlin.coroutines.Continuation p0) + + public abstract java.util.concurrent.CompletableFuture valueAsync() + + public abstract Bar valueBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object run(Api api, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture runAsync(Api api) + + public java.lang.Object runBlocking(Api api) + + public java.lang.Object value(kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture valueAsync() + + public Tar valueBlocking() + + public Bar valueBlocking() +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt new file mode 100644 index 0000000..b9e8fdf --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt @@ -0,0 +1,218 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:Api modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + CONSTRUCTOR visibility:public <> () returnType:.Api.Api> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Api modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN ($this:.Foo<.Tar>, api:.Api.FooImpl.runAsync>) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.runAsync> + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN ($this:.Foo<.Tar>, api:.Api.FooImpl.runBlocking>) returnType:R of .FooImpl.runBlocking [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.runBlocking> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:valueAsync visibility:public modality:OPEN <> ($this:.Foo<.Tar>) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + FUN FAKE_OVERRIDE name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo<.Tar>) returnType:.Tar [fake_override] + annotations: + Api4J + overridden: + public open fun valueBlocking (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + FUN name:run visibility:public modality:OPEN ($this:.FooImpl, api:.Api.FooImpl.run>) returnType:R of .FooImpl.run [suspend] + overridden: + public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.run> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (api: .Api.FooImpl.run>): R of .FooImpl.run declared in .FooImpl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:value visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun value (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun value (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo.Foo> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[.Bar] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null + : + $this: GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null + api: GET_VAR 'api: .Api.Foo.runAsync> declared in .Foo.runAsync' type=.Api.Foo.runAsync> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking + annotations: + Api4J + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runBlocking> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.runBlocking> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.runBlocking [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.runBlocking declared in .Foo.runBlocking' + CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null + : + $this: GET_VAR ': .Foo.Foo> declared in .Foo.runBlocking' type=.Foo.Foo> origin=null + api: GET_VAR 'api: .Api.Foo.runBlocking> declared in .Foo.runBlocking' type=.Api.Foo.runBlocking> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null + FUN name:run visibility:public modality:ABSTRACT ($this:.Foo.Foo>, api:.Api.Foo.run>) returnType:R of .Foo.run [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuRm9vPFQ+bnVsbEFwaTxSPg==") + JvmSynthetic + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.run> + FUN name:value visibility:public modality:ABSTRACT <> ($this:.Foo.Foo>) returnType:T of .Foo [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "dmFsdWVGb288VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo.Foo> diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt new file mode 100644 index 0000000..cc5bfb9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt @@ -0,0 +1,47 @@ +FILE: Main.kt + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } + public final class Api : R|kotlin/Any| { + public constructor(): R|Api| { + super() + } + + } + public abstract interface Foo : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(dmFsdWVGb288VD5udWxs)) public abstract suspend fun value(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vPFQ+bnVsbEFwaTxSPg==)) public abstract suspend fun run(api: R|Api|): R|R| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun value(): R|Tar| { + ^value R|/Tar.Tar|() + } + + public open override suspend fun run(api: R|Api|): R|R| { + ^run R|kotlin/TODO|() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt new file mode 100644 index 0000000..164eb39 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt @@ -0,0 +1,32 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +open class Bar +class Tar : Bar() + +class Api + +interface Foo { + @JvmBlocking + @JvmAsync + suspend fun value(): T + + @JvmBlocking + @JvmAsync + suspend fun run(api: Api): R +} + +class FooImpl : Foo { + override suspend fun value(): Tar { + return Tar() + } + + override suspend fun run(api: Api): R { + return TODO() + } +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt new file mode 100644 index 0000000..437a7ce --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt @@ -0,0 +1,35 @@ +public abstract interface Api : java/lang/Object { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) +} + +public final class ApiExecutable$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture executeAsync(ApiExecutable $this, Api api) +} + +final class ApiExecutable$executeAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final ApiExecutable this$0 + + void (ApiExecutable $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface ApiExecutable : java/lang/Object { + public abstract java.lang.Object execute(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture executeAsync(Api p0) +} + +public abstract interface ApiResult : java/lang/Object { + +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt new file mode 100644 index 0000000..5436658 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt @@ -0,0 +1,77 @@ +FILE fqName: fileName:/Main.kt + CLASS INTERFACE name:Api modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Api.Api>) returnType:T of .Api [suspend] + $this: VALUE_PARAMETER name: type:.Api.Api> + CLASS INTERFACE name:ApiExecutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiExecutable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:executeAsync visibility:public modality:OPEN ($this:.ApiExecutable, api:.Api.ApiExecutable.executeAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.executeAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun executeAsync (api: .Api.ApiExecutable.executeAsync>): java.util.concurrent.CompletableFuture declared in .ApiExecutable' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable.executeAsync' + CALL 'public abstract fun execute (api: .Api.ApiExecutable.execute>): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable' type=.ApiResult<.Api.ApiExecutable.execute>> origin=null + : + $this: GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + api: GET_VAR 'api: .Api.ApiExecutable.executeAsync> declared in .ApiExecutable.executeAsync' type=.Api.ApiExecutable.executeAsync> origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + FUN name:execute visibility:public modality:ABSTRACT ($this:.ApiExecutable, api:.Api.ApiExecutable.execute>) returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZXhlY3V0ZUFwaUV4ZWN1dGFibGVudWxsQXBpPFQ+") + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.execute> + CLASS INTERFACE name:ApiResult modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiResult.ApiResult> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt new file mode 100644 index 0000000..d5b63b8 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt @@ -0,0 +1,18 @@ +FILE: Main.kt + public abstract interface Api : R|kotlin/Any| { + public abstract suspend fun run(): R|T| + + } + public abstract interface ApiResult : R|kotlin/Any| { + } + public abstract interface ApiExecutable : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXhlY3V0ZUFwaUV4ZWN1dGFibGVudWxsQXBpPFQ+)) public abstract suspend fun execute(api: R|Api|): R|ApiResult>| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun executeAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture>>| { + ^executeAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|ApiResult>| { + ^ this@R|/ApiExecutable|.R|/ApiExecutable.execute|(R|/api|) + } + , (this@R|/ApiExecutable| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt new file mode 100644 index 0000000..39afb79 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt @@ -0,0 +1,17 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +interface Api { + suspend fun run(): T +} + +interface ApiResult + +interface ApiExecutable { + @JvmAsync + suspend fun execute(api: Api): ApiResult> +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt new file mode 100644 index 0000000..6035411 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt @@ -0,0 +1,47 @@ +final class MyClass$deleteAllAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$deleteAllBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract class MyClass : java/lang/Object { + public void () + + public java.lang.Object deleteAll(int option, kotlin.coroutines.Continuation $completion) + + static java.lang.Object deleteAll$suspendImpl(MyClass $this, int option, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture deleteAllAsync(int option) + + public int deleteAllBlocking(int option) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt new file mode 100644 index 0000000..ef335a7 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:deleteAllAsync visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllAsync (option: kotlin.Int): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllAsync' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllAsync' type=kotlin.Int origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:deleteAllBlocking visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllBlocking (option: kotlin.Int): kotlin.Int declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllBlocking' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllBlocking' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllBlocking' type=kotlin.Int origin=null + FUN name:deleteAll visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGVsZXRlQWxsTXlDbGFzc251bGxrb3RsaW4vSW50") + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt new file mode 100644 index 0000000..7833a8e --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt @@ -0,0 +1,25 @@ +FILE: Main.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGVsZXRlQWxsTXlDbGFzc251bGxrb3RsaW4vSW50)) public open suspend fun deleteAll(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAll Int(1) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllAsync(option: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^deleteAllAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllBlocking(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAllBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + ) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt new file mode 100644 index 0000000..35c8c67 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt @@ -0,0 +1,19 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + + +abstract class MyClass { + @JvmBlocking + @JvmAsync + suspend open fun deleteAll(option: Int): Int { + return 1 + } + +} + diff --git a/tests/test-js/build.gradle.kts b/tests/test-js/build.gradle.kts index 92a1650..f215be2 100644 --- a/tests/test-js/build.gradle.kts +++ b/tests/test-js/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.9.4") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.11.0") } } @@ -35,6 +35,7 @@ kotlin { js(IR) { nodejs() + useEsModules() generateTypeScriptDefinitions() binaries.executable() @@ -50,13 +51,15 @@ kotlin { } sourceSets { - named("jsMain") { - dependencies { - implementation(kotlin("stdlib")) - api(libs.kotlinx.coroutines.core) - api(project(":runtime:suspend-transform-annotation")) - api(project(":runtime:suspend-transform-runtime")) - } + jsMain.dependencies { + implementation(kotlin("stdlib")) + implementation(libs.kotlinx.coroutines.core) + implementation(project(":runtime:suspend-transform-annotation")) + implementation(project(":runtime:suspend-transform-runtime")) + } + jsTest.dependencies { + implementation(kotlin("test")) + implementation(libs.kotlinx.coroutines.test) } } } diff --git a/tests/test-js/src/jsMain/kotlin/AsPropertyTests.kt b/tests/test-js/src/jsMain/kotlin/AsPropertyInterface.kt similarity index 100% rename from tests/test-js/src/jsMain/kotlin/AsPropertyTests.kt rename to tests/test-js/src/jsMain/kotlin/AsPropertyInterface.kt diff --git a/tests/test-js/src/jsMain/kotlin/Main.kt b/tests/test-js/src/jsMain/kotlin/Main.kt index 6e15fba..3165099 100644 --- a/tests/test-js/src/jsMain/kotlin/Main.kt +++ b/tests/test-js/src/jsMain/kotlin/Main.kt @@ -1,10 +1,9 @@ +import kotlinx.coroutines.await import kotlin.js.Promise suspend fun main() { -// runInAsync(block = SuspendFun()).await() - Promise // keep import - println(ForteScarlet().stringToInt("1")) -// println(ForteScarlet().stringToIntAsync("1")) -// println(ForteScarlet().stringToIntAsync("1").await()) + println(ForteScarlet().asDynamic().stringToIntAsync("1")) + println(ForteScarlet().asDynamic().stringToIntAsync("1").unsafeCast>().await()) + } diff --git a/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt b/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt new file mode 100644 index 0000000..2907aad --- /dev/null +++ b/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt @@ -0,0 +1,21 @@ +import kotlinx.coroutines.await +import kotlinx.coroutines.test.runTest +import kotlin.js.Promise +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs + +/** + * + * @author ForteScarlet + */ +class AsPropertyTest { + + @Test + fun testAsProperty() = runTest { + val impl = AsPropertyImpl() + assertIs>(impl.asDynamic().valueAsync) + assertEquals("Hello, World", impl.asDynamic().valueAsync.unsafeCast>().await()) + } + +} diff --git a/tests/test-js/src/jsTest/kotlin/PromiseTest.kt b/tests/test-js/src/jsTest/kotlin/PromiseTest.kt new file mode 100644 index 0000000..d4f4dcf --- /dev/null +++ b/tests/test-js/src/jsTest/kotlin/PromiseTest.kt @@ -0,0 +1,21 @@ +import kotlinx.coroutines.await +import kotlinx.coroutines.test.runTest +import kotlin.js.Promise +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs + +/** + * + * @author ForteScarlet + */ +class PromiseTest { + + @Test + fun testPromise() = runTest { + assertEquals(1, ForteScarlet().stringToInt("1")) + assertIs>(ForteScarlet().asDynamic().stringToIntAsync("1")) + assertEquals(1, ForteScarlet().asDynamic().stringToIntAsync("1").unsafeCast>().await()) + } + +} diff --git a/tests/test-jvm/build.gradle.kts b/tests/test-jvm/build.gradle.kts index c254dda..5dbc007 100644 --- a/tests/test-jvm/build.gradle.kts +++ b/tests/test-jvm/build.gradle.kts @@ -19,7 +19,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.9.4") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.11.0") } } diff --git a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt new file mode 100644 index 0000000..3447091 --- /dev/null +++ b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt @@ -0,0 +1,44 @@ +package love.forte.plugin.suspendtrans.sample + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +/** + * 对“接受行为”的支持,由 [RequestEvent] 实现。 + * + * @author ForteScarlet + */ +interface AcceptSupport { + /** + * 接受此请求。 + * + * @throws Throwable 任何可能产生的错误。 + */ + @JvmBlocking + @JvmAsync + suspend fun accept() + + /** + * 接受此请求。 + * + * 对实现者:此函数具有默认实现以确保二进制兼容。 + * + * @param options 用于当前接受行为的可选项。 + * 如果某选项实现不支持则会被忽略,支持的范围由实现者决定。 + * @since 4.0.0-RC3 + * @throws Throwable 任何可能产生的错误。 + */ + @JvmBlocking + @JvmAsync + suspend fun accept(vararg options: AcceptOption) { + accept() + } +} + +/** + * [AcceptSupport.accept] 的可选项。 + * [AcceptOption] 可以自由扩展,且如果遇到不支持的实现则会将其忽略。 + * + * @see AcceptSupport.accept + */ +interface AcceptOption diff --git a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt index e3a3c1e..799b8c8 100644 --- a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt +++ b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt @@ -18,4 +18,7 @@ interface ApiExecutable { @JvmAsync suspend fun execute2(api: Api): ApiResult + + @JvmAsync + suspend fun execute3(api: Api): ApiResult> } diff --git a/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt b/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt index 93f9407..6df947e 100644 --- a/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt +++ b/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt @@ -26,10 +26,7 @@ import java.lang.reflect.Modifier import java.util.concurrent.CompletableFuture import kotlin.reflect.KTypeParameter import kotlin.reflect.full.memberProperties -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertTrue +import kotlin.test.* @JvmBlocking @@ -61,6 +58,11 @@ interface TypedTrans1Impl : ITypedTrans1 { override suspend fun value(): T } +class STPTrans1Impl : STPTrans1 { + override suspend fun run1(): Int = 1 + override suspend fun run2(): String = "run2" +} + /** * * @author ForteScarlet @@ -125,7 +127,6 @@ class SuspendTransformTests { } - @Test fun `typed interface test`() { with(ITypedTrans1::class) { @@ -149,4 +150,27 @@ class SuspendTransformTests { }) } } + + @Test + fun `invoke test`() { + val stp = STPTrans1Impl() + + val run1BlockingMethod = STPTrans1::class.java.getMethod("getRun1") + val run2BlockingMethod = STPTrans1::class.java.getMethod("getRun2") + + val run1AsyncMethod = STPTrans1::class.java.getMethod("getRun1Ay") + val run2AsyncMethod = STPTrans1::class.java.getMethod("getRun2Ay") + + assertEquals(1, run1BlockingMethod.invoke(stp)) + assertEquals("run2", run2BlockingMethod.invoke(stp)) + + val run1Async = run1AsyncMethod.invoke(stp) + val run2Async = run2AsyncMethod.invoke(stp) + + assertIs>(run1Async) + assertIs>(run2Async) + + assertEquals(1, run1Async.get()) + assertEquals("run2", run2Async.get()) + } } From 61c031caf635c2869a1c73840dbb2467319c7067 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Sun, 19 Jan 2025 02:50:05 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=B0=B1=E5=B7=AE=E9=82=A3=E4=B9=88?= =?UTF-8?q?=E4=B8=80=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fir/SuspendTransformFirTransformer.kt | 107 ++++++++++++++++-- .../ir/SuspendTransformTransformer.kt | 33 +++--- .../runners/CodeGenTestRunnerGenerated.java | 6 + .../src/testData/codegen/varargParam.kt | 18 +++ 4 files changed, 144 insertions(+), 20 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index e408557..9794db5 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -6,7 +6,7 @@ import love.forte.plugin.suspendtrans.utils.TransformAnnotationData import love.forte.plugin.suspendtrans.utils.toClassId import love.forte.plugin.suspendtrans.utils.toInfo import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol @@ -14,24 +14,25 @@ import org.jetbrains.kotlin.fir.analysis.checkers.processOverriddenFunctions import org.jetbrains.kotlin.fir.caches.FirCache import org.jetbrains.kotlin.fir.caches.firCachesFactory import org.jetbrains.kotlin.fir.caches.getValue -import org.jetbrains.kotlin.fir.collectUpperBounds -import org.jetbrains.kotlin.fir.copy import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.builder.* +import org.jetbrains.kotlin.fir.declarations.impl.FirResolvedDeclarationStatusImpl import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality -import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression +import org.jetbrains.kotlin.fir.expressions.buildResolvedArgumentList import org.jetbrains.kotlin.fir.expressions.builder.* +import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.plugin.createConeType +import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope @@ -257,7 +258,7 @@ class SuspendTransformFirTransformer( if (annotations.none { it.fqName(session) == targetMarkerAnnotation.asSingleFqName() && (it.argumentMapping.mapping[targetMarkerValueName] as? FirLiteralExpression) - ?.value == markerId + ?.value == markerId }) { replaceAnnotations( buildList { @@ -335,6 +336,8 @@ class SuspendTransformFirTransformer( ) ) + val funTarget = FirFunctionTarget(null, false) + val newFun = buildSimpleFunctionCopy(originFunc) { name = callableId.callableName symbol = newFunSymbol @@ -363,12 +366,100 @@ class SuspendTransformFirTransformer( annotations.clear() annotations.addAll(functionAnnotations) - body = null val returnType = resolveReturnType(originFunc, funData, returnTypeRef) - returnTypeRef = returnType + body = buildBlock { + this.source = originFunc.body?.source + + // lambda: () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.isLambda = true + this.moduleData = originFunc.moduleData + this.origin = key.origin + this.returnTypeRef = originFunc.returnTypeRef + this.hasExplicitParameterList = false + this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.source = originFunc.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunc.source + this.name = originFunc.name + this.resolvedSymbol = originFunc.symbol + } +// this.argumentList = buildArgumentList { +// for (originParam in originFunc.valueParameters) { +// arguments.add(originParam.toQualifiedAccess()) +// } +// } + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + for (originParam in originFunc.valueParameters) { + put(originParam.toQualifiedAccess(), originParam) + } + } + ) + } + } + ) + } + lambdaTarget.bind(lambda) + + this.statements.add(buildAnonymousFunctionExpression { + this.anonymousFunction = lambda + this.isTrailingLambda = false + }) + +// this.statements.add( +// buildReturnExpression { +// this.target = funTarget +// val transformName = with(funData.transformer.transformFunctionInfo) { +// buildString { +// if (packageName.isNotEmpty()) { +// append(packageName) +// append('.') +// } +// if (className?.isNotEmpty() == true) { +// append(className) +// append('.') +// } +// append(functionName) +// } +// } +// +// holder.session.moduleData.dependencies +// +// this.result = buildFunctionCall { +// this.source = null + // TODO 必须 resolved +// this.calleeReference = buildSimpleNamedReference { +// this.source = null +// this.name = Name.identifier(transformName) +// } + // TODO Argument 必须 resolved +//// this.argumentList = buildArgumentList { +//// arguments.add(buildAnonymousFunctionExpression { +//// this.source = lambda.source +//// this.anonymousFunction = lambda +//// this.isTrailingLambda = false +//// }) +//// // TODO scope? +//// } +// } +// } +// ) + // ConeClassLikeType() + } + // body = null + // TODO 是否可以在FIR中就完成Body的构建? // buildBlock { // // build lambda @@ -429,6 +520,8 @@ class SuspendTransformFirTransformer( origin = key.origin } + funTarget.bind(newFun) + if (targetMarkerAnnotation != null) { originFunc.appendTargetMarker(uniqueFunHash) } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 5f9888f..43bbdae 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -95,15 +95,19 @@ class SuspendTransformTransformer( pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) }, callableFunction - )?.also { generatedOriginFunction -> + ).also { generatedOriginFunction -> if (property != null) { // NO! BACKING! FIELD! property.backingField = null } - postProcessGenerateOriginFunction( - generatedOriginFunction, - pluginKey.data.transformer.originFunctionIncludeAnnotations - ) + + if (generatedOriginFunction != null) { + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } } @@ -162,6 +166,11 @@ class SuspendTransformTransformer( crossinline checkIsOriginFunction: (IrFunction) -> Boolean, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrFunction? { + if (function.body != null) { + return null + } + + val parent = function.parent if (parent is IrDeclarationContainer) { @@ -255,14 +264,12 @@ class SuspendTransformTransformer( originFunction.reportLocation() ?: function.reportLocation() ) - if (function.body == null) { - function.body = generateTransformBodyForFunctionLambda( - pluginContext, - function, - originFunction, - transformTargetFunctionCall - ) - } + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + originFunction, + transformTargetFunctionCall + ) return originFunction } diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index d1eb602..505d025 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -67,4 +67,10 @@ public void testImplOverridenGeneric() { public void testAlias() { runTest("src/testData/codegen/alias.kt"); } + + @Test + @TestMetadata("varargParam.kt") + public void testVarargParam() { + runTest("src/testData/codegen/varargParam.kt"); + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt new file mode 100644 index 0000000..a95caea --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt @@ -0,0 +1,18 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +public interface DeleteOption + +abstract class MyClass { + @JvmBlocking + @JvmAsync + suspend open fun deleteAll(vararg options: DeleteOption): Int { + return 1 + } +} From 8960a13168d376a446f14e618e8407a10b6df534 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Wed, 22 Jan 2025 02:07:58 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../suspendtrans/SuspendTransformUserData.kt | 5 + .../fir/SuspendTransformFirTransformer.kt | 740 +++++++++++------- .../fir/SuspendTransformPluginKey.kt | 9 +- .../ir/SuspendTransformTransformer.kt | 166 ++-- .../runners/AbstractCodeGenTestRunner.kt | 2 +- .../src/testData/codegen/varargParam.kt | 5 +- local-helper/build.gradle.kts | 59 ++ .../src/commonMain/kotlin/MyInterface.kt | 38 + settings.gradle.kts | 2 + 9 files changed, 688 insertions(+), 338 deletions(-) create mode 100644 local-helper/build.gradle.kts create mode 100644 local-helper/src/commonMain/kotlin/MyInterface.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt index dac40c6..9207100 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformUserData.kt @@ -147,6 +147,11 @@ data class SuspendTransformUserDataFir( val transformer: Transformer ) +data class SuspendTransformBridgeFunDataFir( + val asProperty: Boolean, + val transformer: Transformer +) + fun FirNamedFunctionSymbol.asOriginSymbol( targetMarker: ClassId?, typeParameters: List, diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 9794db5..1e58b28 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -1,11 +1,10 @@ package love.forte.plugin.suspendtrans.fir import love.forte.plugin.suspendtrans.* -import love.forte.plugin.suspendtrans.utils.CopyAnnotationsData -import love.forte.plugin.suspendtrans.utils.TransformAnnotationData -import love.forte.plugin.suspendtrans.utils.toClassId -import love.forte.plugin.suspendtrans.utils.toInfo +import love.forte.plugin.suspendtrans.utils.* +import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext @@ -21,6 +20,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality +import org.jetbrains.kotlin.fir.deserialization.replaceName import org.jetbrains.kotlin.fir.expressions.FirAnnotation import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression @@ -32,9 +32,12 @@ import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar import org.jetbrains.kotlin.fir.extensions.MemberGenerationContext import org.jetbrains.kotlin.fir.extensions.predicate.DeclarationPredicate import org.jetbrains.kotlin.fir.plugin.createConeType +import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference +import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.* import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve +import org.jetbrains.kotlin.fir.resolve.transformers.ScopeClassDeclaration import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.scopes.processAllFunctions @@ -43,6 +46,7 @@ import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef +import org.jetbrains.kotlin.fir.types.builder.buildFunctionTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId @@ -56,6 +60,7 @@ import org.jetbrains.kotlin.platform.konan.isNative import org.jetbrains.kotlin.types.ConstantValueKind import java.util.* import java.util.concurrent.ConcurrentHashMap +import java.util.concurrent.atomic.AtomicInteger private data class CopiedTypeParameterPair( val original: FirTypeParameter, @@ -78,10 +83,33 @@ class SuspendTransformFirTransformer( val memberScope: FirClassDeclaredMemberScope? ) - private data class FunData( - val annotationData: TransformAnnotationData, - val transformer: Transformer, - ) + private sealed class FunData { + abstract val funName: Name + abstract val transformer: Transformer + abstract val annotationData: TransformAnnotationData + } + + // synthetic fun 需要知道 bridge fun, 反之则不需要 + + private data class SyntheticFunData( + override val funName: Name, + val bridgeFunData: BridgeFunData, + ) : FunData() { + override val annotationData: TransformAnnotationData + get() = bridgeFunData.annotationData + override val transformer: Transformer + get() = bridgeFunData.transformer + } + + private data class BridgeFunData( + override val funName: Name, + val symbol: FirNamedFunctionSymbol, + val target: FirFunctionTarget, + val lambdaParameter: FirValueParameter, + val returnType: FirTypeRef, + override val annotationData: TransformAnnotationData, + override val transformer: Transformer, + ) : FunData() // private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = private val cache: FirCache>?, Nothing?> = @@ -93,9 +121,9 @@ class SuspendTransformFirTransformer( override fun getCallableNamesForClass(classSymbol: FirClassSymbol<*>, context: MemberGenerationContext): Set { val names = mutableSetOf() - cache.getValue(FirCacheKey(classSymbol, context.declaredScope))?.forEach { (_, map) -> - map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } +// map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } + map.values.forEach { names.add(it.funName) } } return names @@ -298,239 +326,310 @@ class SuspendTransformFirTransformer( val funList = arrayListOf() funcMap.forEach { (func, funData) -> + when (funData) { + is BridgeFunData -> { + generateBridgeFunctions( + callableId, + context, + owner, + func, + funData, + funList, + ) + } - val annotationData = funData.annotationData - if (!annotationData.asProperty) { - // Check the overridden for isOverride based on source function (func) 's overridden - val isOverride = checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, func, checkContext) + is SyntheticFunData -> { + generateSyntheticFunctions( + callableId, + context, + owner, + func, + funData, + funList, + ) + } + } + } - // generate + return funList + } + + private fun generateBridgeFunctions( + callableId: CallableId, + context: MemberGenerationContext?, + owner: FirClassSymbol<*>, + originFunSymbol: FirNamedFunctionSymbol, + funData: BridgeFunData, + results: MutableList, + ) { + // private inline fun $name(block: suspend () -> T): returnType // IR -> {} + val key = SuspendTransformBridgeFunctionKey( + data = SuspendTransformBridgeFunDataFir( + asProperty = false, + transformer = funData.transformer + ) + ) + + val bridgeFun = buildSimpleFunction { + name = funData.funName + source = originFunSymbol.source + moduleData = originFunSymbol.moduleData + // see FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS + status = FirResolvedDeclarationStatusImpl( + Visibilities.Private, + Modality.FINAL, + EffectiveVisibility.PrivateInClass + ).copy( + visibility = Visibilities.Private, + modality = Modality.FINAL, + isOverride = false, + isSuspend = false, + isInline = true, + ) + returnTypeRef = funData.returnType + receiverParameter = null + containerSource = originFunSymbol.containerSource + dispatchReceiverType = originFunSymbol.dispatchReceiverType + // TODO 泛型需不需要处理? + valueParameters.add(funData.lambdaParameter) + body = null + symbol = funData.symbol + + // TODO 仅保留跟 originFun.returnType 一样或相关的 type parameter? +// val returnConeType = originFunSymbol.resolvedReturnTypeRef.coneType +// originFunSymbol.typeParameterSymbols.find { originTypeParameterSymbol -> +// returnConeType.copyWithTypeParameters() +// originTypeParameterSymbol +// TODO() +// } + + origin = key.origin + } + + bridgeFun.jvmSynthetic(session) + + funData.target.bind(bridgeFun) + + results.add(bridgeFun.symbol) + } + + @OptIn(SymbolInternals::class) + private fun generateSyntheticFunctions( + callableId: CallableId, + context: MemberGenerationContext?, + owner: FirClassSymbol<*>, + originFunSymbol: FirNamedFunctionSymbol, + funData: SyntheticFunData, + results: MutableList, + ) { + val bridgeFunData = funData.bridgeFunData + + val annotationData = funData.annotationData + if (!annotationData.asProperty) { + // Check the overridden for isOverride based on source function (func) 's overridden + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originFunSymbol, checkContext) - val originFunc = func.fir + // generate + val originFunc = originFunSymbol.fir - val uniqueFunHash = originFunc.calculateOriginFuncHash() + val uniqueFunHash = originFunc.calculateOriginFuncHash() - // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 + // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 // val syntheticFunCallableName = callableId.callableName.asString() + "-f-${uniqueFunHash}" // val syntheticFunName = callableId.copy(Name.identifier(syntheticFunCallableName)) // val syntheticFun = originFunc.copySyntheticFun(owner, callableId) // funList.add(syntheticFun.symbol) - val (functionAnnotations, _) = copyAnnotations(originFunc, funData) - - val newFunSymbol = FirNamedFunctionSymbol(callableId) + val (functionAnnotations, _) = copyAnnotations(originFunc, funData) + + val newFunSymbol = FirNamedFunctionSymbol(callableId) + + val key = SuspendTransformPluginKey( + data = SuspendTransformUserDataFir( + markerId = uniqueFunHash, + originSymbol = originFunc.symbol.asOriginSymbol( + targetMarkerAnnotation, + typeParameters = originFunc.typeParameters, + valueParameters = originFunc.valueParameters, + originFunc.returnTypeRef.coneTypeOrNull?.classId, + session, + ), + asProperty = false, + transformer = funData.transformer + ) + ) - val key = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = originFunc.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = originFunc.typeParameters, - valueParameters = originFunc.valueParameters, - originFunc.returnTypeRef.coneTypeOrNull?.classId, - session, - ), - asProperty = false, - transformer = funData.transformer - ) + val newFunTarget = FirFunctionTarget(null, isLambda = false) + val newFun = buildSimpleFunctionCopy(originFunc) { + name = callableId.callableName + symbol = newFunSymbol + status = originFunc.status.copy( + isSuspend = false, + modality = originFunc.syntheticModifier, + // Use OPEN and `override` is unnecessary. .. ... Maybe? + isOverride = isOverride || isOverridable( + session, + callableId.callableName, + originFunc, + owner, + isProperty = false, + ), ) - val funTarget = FirFunctionTarget(null, false) + // Copy the typeParameters. + // Otherwise, in functions like the following, an error will occur + // suspend fun data(value: A): T = ... + // Functions for which function-scoped generalizations (``) exist. + // In the generated IR, data and dataBlocking will share an `A`, generating the error. + // The error: Duplicate IR node + // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] + // TODO copy to value parameters, receiver and + // return type? + copyParameters() - val newFun = buildSimpleFunctionCopy(originFunc) { - name = callableId.callableName - symbol = newFunSymbol - status = originFunc.status.copy( - isSuspend = false, - modality = originFunc.syntheticModifier, - // Use OPEN and `override` is unnecessary. .. ... Maybe? - isOverride = isOverride || isOverridable( - session, - callableId.callableName, - originFunc, - owner, - isProperty = false, - ), - ) + val thisReceiverParameter = this.receiverParameter + val thisContextReceivers = this.contextReceivers + val thisValueParameters = this.valueParameters - // Copy the typeParameters. - // Otherwise, in functions like the following, an error will occur - // suspend fun data(value: A): T = ... - // Functions for which function-scoped generalizations (``) exist. - // In the generated IR, data and dataBlocking will share an `A`, generating the error. - // The error: Duplicate IR node - // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] - // TODO copy to value parameters, receiver and return type? - copyParameters() + annotations.clear() + annotations.addAll(functionAnnotations) - annotations.clear() - annotations.addAll(functionAnnotations) + returnTypeRef = funData.bridgeFunData.returnType - val returnType = resolveReturnType(originFunc, funData, returnTypeRef) - returnTypeRef = returnType + /* + * __suspendTransform__run_0_runBlocking({ run(times) }) + */ + + body = buildBlock { + this.source = originFunc.body?.source + + // lambda: suspend () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.isLambda = true + this.moduleData = originFunSymbol.moduleData +// this.origin = key.origin + this.origin = FirDeclarationOrigin.Synthetic.FakeFunction + this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef + this.hasExplicitParameterList = false + this.status = + FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType + this.source = originFunSymbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunSymbol.source + this.name = originFunSymbol.name + this.resolvedSymbol = originFunSymbol + } - body = buildBlock { - this.source = originFunc.body?.source - - // lambda: () -> T - val lambdaTarget = FirFunctionTarget(null, isLambda = true) - val lambda = buildAnonymousFunction { - this.isLambda = true - this.moduleData = originFunc.moduleData - this.origin = key.origin - this.returnTypeRef = originFunc.returnTypeRef - this.hasExplicitParameterList = false - this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - this.symbol = FirAnonymousFunctionSymbol() - this.body = buildSingleExpressionBlock( - buildReturnExpression { - target = lambdaTarget - result = buildFunctionCall { - // Call original fun - this.source = originFunc.source - this.calleeReference = buildResolvedNamedReference { - this.source = originFunc.source - this.name = originFunc.name - this.resolvedSymbol = originFunc.symbol + val originValueParameters = originFunc.valueParameters + + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner } -// this.argumentList = buildArgumentList { -// for (originParam in originFunc.valueParameters) { -// arguments.add(originParam.toQualifiedAccess()) -// } -// } - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - for (originParam in originFunc.valueParameters) { - put(originParam.toQualifiedAccess(), originParam) - } + } + + // TODO? + this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> + buildThisReceiverExpression { + coneTypeOrNull = receiver.typeRef.coneTypeOrNull + source = receiver.source + calleeReference = buildExplicitThisReference { + source = receiver.source + labelName = receiver.labelName?.asString() } - ) + } + }) + + // TODO? + this.explicitReceiver = thisReceiverParameter?.let { thisExplicitReceiver -> + buildThisReceiverExpression { + coneTypeOrNull = thisExplicitReceiver.typeRef.coneTypeOrNull + source = thisExplicitReceiver.source + calleeReference = buildExplicitThisReference { + source = thisExplicitReceiver.source + } + } } - } - ) - } - lambdaTarget.bind(lambda) - this.statements.add(buildAnonymousFunctionExpression { - this.anonymousFunction = lambda - this.isTrailingLambda = false - }) + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + thisValueParameters.forEachIndexed { index, thisParam -> + val qualifiedAccess = thisParam.toQualifiedAccess() + put(qualifiedAccess, originValueParameters[index]) + } + } + ) + } + } + ) -// this.statements.add( -// buildReturnExpression { -// this.target = funTarget -// val transformName = with(funData.transformer.transformFunctionInfo) { -// buildString { -// if (packageName.isNotEmpty()) { -// append(packageName) -// append('.') -// } -// if (className?.isNotEmpty() == true) { -// append(className) -// append('.') -// } -// append(functionName) -// } -// } -// -// holder.session.moduleData.dependencies -// -// this.result = buildFunctionCall { -// this.source = null - // TODO 必须 resolved -// this.calleeReference = buildSimpleNamedReference { -// this.source = null -// this.name = Name.identifier(transformName) -// } - // TODO Argument 必须 resolved -//// this.argumentList = buildArgumentList { -//// arguments.add(buildAnonymousFunctionExpression { -//// this.source = lambda.source -//// this.anonymousFunction = lambda -//// this.isTrailingLambda = false -//// }) -//// // TODO scope? -//// } -// } -// } -// ) - // ConeClassLikeType() + this.typeRef = bridgeFunData.lambdaParameter.returnTypeRef } - // body = null - - // TODO 是否可以在FIR中就完成Body的构建? -// buildBlock { -// // build lambda -// val lambda = buildAnonymousFunctionExpression { -// anonymousFunction = buildAnonymousFunction { -// moduleData = originFunc.moduleData -// origin = key.origin -// status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION -// returnTypeRef = originFunc.returnTypeRef -// isLambda = true -// body = buildSingleExpressionBlock( -// buildReturnExpression { -// result = buildFunctionCall { -//// explicitReceiver = this@createConventionCall -// calleeReference = buildResolvedNamedReference { -// source = originFunc.source -// name = originFunc.name -// resolvedSymbol = originFunc.symbol -// } -// -// argumentList = buildResolvedArgumentList(null, -// this@buildSimpleFunctionCopy.valueParameters.associateByTo(LinkedHashMap()) { valueParameter -> -// buildCallableReferenceAccess { -// source = valueParameter.source -// calleeReference = buildResolvedNamedReference { -// source = valueParameter.source -// name = valueParameter.name -// resolvedSymbol = valueParameter.symbol -// } -// coneTypeOrNull = valueParameter.returnTypeRef.coneTypeOrNull -// } -// } -// ) -// } -// } -// ) -// symbol = FirAnonymousFunctionSymbol() -// } -// } -// lambda -// -// -// /* -// fun xxxBlock() = transformFun({ orignFun }, ) -// */ -// statements.add( -// buildReturnExpression { -// -// -// } -// ) -// -// buildFunctionCall { -// this -// } -// } - - origin = key.origin - } + lambdaTarget.bind(lambda) + + // bind to bridge fun + + this.statements.add( + buildReturnExpression { + this.target = newFunTarget + this.result = buildFunctionCall { + this.coneTypeOrNull = bridgeFunData.returnType.coneType + this.source = bridgeFunData.symbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = bridgeFunData.symbol.source + this.name = bridgeFunData.symbol.name + this.resolvedSymbol = bridgeFunData.symbol + } - funTarget.bind(newFun) + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + } - if (targetMarkerAnnotation != null) { - originFunc.appendTargetMarker(uniqueFunHash) + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put(buildAnonymousFunctionExpression { + source = null + anonymousFunction = lambda + isTrailingLambda = false + }, funData.bridgeFunData.lambdaParameter) + } + ) + } + } + ) } + // body = null - funList.add(newFun.symbol) + origin = key.origin } - } - return funList + if (targetMarkerAnnotation != null) { + originFunc.appendTargetMarker(uniqueFunHash) + } + + // TODO 在原函数上附加的annotations + + newFunTarget.bind(newFun) + results.add(newFun.symbol) + } } @OptIn(SymbolInternals::class) @@ -545,44 +644,49 @@ class SuspendTransformFirTransformer( val propList = mutableListOf() - funcMap.forEach { (func, funData) -> + for ((originalFunSymbol, funData) in funcMap) { + if (funData !is SyntheticFunData) { + continue + } + val annotationData = funData.annotationData if (annotationData.asProperty) { - val isOverride = checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, func, checkContext) + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) // generate - val original = func.fir + val original = originalFunSymbol.fir val uniqueFunHash = original.calculateOriginFuncHash() val (functionAnnotations, propertyAnnotations) = copyAnnotations(original, funData) -// val p = createMemberProperty() -// owner = owner, -// key = SuspendTransformPluginKey( -// data = SuspendTransformUserDataFir( -// originSymbol = original.symbol.asOriginSymbol( -// typeParameters = original.typeParameters, -// valueParameters = original.valueParameters, -// original.returnTypeRef.coneTypeOrNull?.classId -// ), -// asProperty = true, -// transformer = funData.transformer -// ) -// ), -// name = callableId.callableName, -// returnTypeProvider = { resolveReturnConeType(original, funData) }, -// isVal = true, -// hasBackingField = false, -// ) { -// modality = original.syntheticModifier ?: Modality.FINAL -// // TODO receiver? -//// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull -//// if (receiverType != null) { -//// extensionReceiverType(receiverType) -//// } -// } + // val p = createMemberProperty() + // owner = owner, + // key = SuspendTransformPluginKey( + // data = SuspendTransformUserDataFir( + // originSymbol = original.symbol.asOriginSymbol( + // typeParameters = original.typeParameters, + // valueParameters = original.valueParameters, + // original.returnTypeRef.coneTypeOrNull?.classId + // ), + // asProperty = true, + // transformer = funData.transformer + // ) + // ), + // name = callableId.callableName, + // returnTypeProvider = { resolveReturnConeType(original, funData) }, + // isVal = true, + // hasBackingField = false, + // ) { + // modality = original.syntheticModifier ?: Modality.FINAL + // // TODO receiver? + //// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull + //// if (receiverType != null) { + //// extensionReceiverType(receiverType) + //// } + // } val pSymbol = FirPropertySymbol(callableId) val pKey = SuspendTransformPluginKey( @@ -601,7 +705,7 @@ class SuspendTransformFirTransformer( ) - val returnType = resolveReturnType(original, funData, original.returnTypeRef) + val returnType = resolveReturnType(funData.transformer, original.returnTypeRef) val p1 = buildProperty { symbol = pSymbol @@ -615,7 +719,7 @@ class SuspendTransformFirTransformer( isSuspend = false, isFun = false, isInner = false, -// modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, + // modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, modality = original.syntheticModifier, isOverride = isOverride || isOverridable( session, @@ -654,23 +758,23 @@ class SuspendTransformFirTransformer( origin = pKey.origin -// attributes = original.attributes.copy() + // attributes = original.attributes.copy() status = original.status.copy( isSuspend = false, isFun = false, isInner = false, modality = original.syntheticModifier, isOverride = false, // funData.isOverride, -// visibility = this@buildProperty.status + // visibility = this@buildProperty.status ) returnTypeRef = original.returnTypeRef -// deprecationsProvider = original.deprecationsProvider -// containerSource = original.containerSource -// dispatchReceiverType = original.dispatchReceiverType -// contextReceivers.addAll(original.contextReceivers) + // deprecationsProvider = original.deprecationsProvider + // containerSource = original.containerSource + // dispatchReceiverType = original.dispatchReceiverType + // contextReceivers.addAll(original.contextReceivers) valueParameters.addAll(original.valueParameters) -// body = null -// contractDescription = original.contractDescription + // body = null + // contractDescription = original.contractDescription typeParameters.addAll(original.typeParameters) } } @@ -680,6 +784,8 @@ class SuspendTransformFirTransformer( if (targetMarkerAnnotation != null) { original.appendTargetMarker(uniqueFunHash) } + + // TODO 在原函数上附加的annotations } } @@ -687,14 +793,14 @@ class SuspendTransformFirTransformer( } private fun checkSyntheticFunctionIsOverrideBasedOnSourceFunction( - funData: FunData, + syntheticFunData: SyntheticFunData, func: FirNamedFunctionSymbol, checkContext: CheckerContext ): Boolean { // Check the overridden for isOverride based on source function (func) 's overridden var isOverride = false - val annoData = funData.annotationData - val markAnnotation = funData.transformer.markAnnotation + val annoData = syntheticFunData.annotationData + val markAnnotation = syntheticFunData.transformer.markAnnotation if (func.isOverride && !isOverride) { func.processOverriddenFunctions( @@ -791,6 +897,23 @@ class SuspendTransformFirTransformer( } } + // TODO + // https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin/issues/75 + // 原始函数生成两个函数: + // 1. xxxBlocking 真正要生成的函数 + // 2. __suspendTransform__$funName_$index_$transFunName 用于提供给 IR 直接生成body的private桥接函数 + + // fun.name -> Counter + val funNameCounters = mutableMapOf() + + fun resolveFunNameCount(name: String): Int = funNameCounters.computeIfAbsent(name) { + AtomicInteger(0) + }.andIncrement + + // Key -> synthetic fun name or bridge fun name + // Value Map -> + // Key: -> origin fun symbol + // Values -> FunData val map = ConcurrentHashMap>() declaredScope.processAllFunctions { func -> @@ -811,12 +934,80 @@ class SuspendTransformFirTransformer( // 必须使用 anno.getXxxArgument(Name(argument name)), // 使用 argumentMapping.mapping 获取不到结果 // println("RAW AnnoData: ${anno.argumentMapping.mapping}") - val annoData = anno.toTransformAnnotationData(markAnnotation, functionName) - val syntheticFunName = Name.identifier(annoData.functionName) - map.computeIfAbsent(syntheticFunName) { ConcurrentHashMap() }[func] = - FunData(annoData, transformer) + val funCount = resolveFunNameCount(functionName) + + val syntheticFunNameString = annoData.functionName + val bridgeFunNameString = bridgeFunName(functionName, funCount, syntheticFunNameString) + + val syntheticFunName = Name.identifier(syntheticFunNameString) + val bridgeFunName = Name.identifier(bridgeFunNameString) + + val bridgeFunCallableId = func.callableId.replaceName(bridgeFunName) + + val bridgeFunSymbol = FirNamedFunctionSymbol(bridgeFunCallableId) + + // noinline suspend () -> T + val suspendLambdaValueParameter = buildValueParameter { + source = func.source + resolvePhase = FirResolvePhase.RAW_FIR + moduleData = func.moduleData + origin = FirDeclarationOrigin.Synthetic.FakeFunction + + returnTypeRef = buildResolvedTypeRef { + source = func.source + val funTypeRef = buildFunctionTypeRef { + source = func.source + isMarkedNullable = false + receiverTypeRef = null + isSuspend = true + returnTypeRef = func.resolvedReturnTypeRef + } + + delegatedTypeRef = funTypeRef + + coneType = session.typeResolver.resolveType( + funTypeRef, + ScopeClassDeclaration(emptyList(), emptyList()), + false, + false, + false, + null, + SupertypeSupplier.Default, + ).type + } + + backingField = null + defaultValue = null + val pname = Name.identifier("block") + name = pname + symbol = FirValueParameterSymbol(pname) + containingFunctionSymbol = bridgeFunSymbol + isVararg = false + isCrossinline = false + isNoinline = true + } + + val returnType = resolveReturnType(transformer, func.resolvedReturnTypeRef) + + val bridgeFunData = BridgeFunData( + bridgeFunName, + bridgeFunSymbol, + FirFunctionTarget(null, false), + suspendLambdaValueParameter, + returnType, + annoData, + transformer + ) + + map.computeIfAbsent(bridgeFunName) { name -> + ConcurrentHashMap() + }[func] = bridgeFunData + + map.computeIfAbsent(syntheticFunName) { + ConcurrentHashMap() + }[func] = SyntheticFunData(syntheticFunName, bridgeFunData) } } } @@ -824,6 +1015,11 @@ class SuspendTransformFirTransformer( return map } + private fun bridgeFunName(original: String, count: Int, syntheticFun: String): String { + // __suspendTransform__run_0_runBlocking + return "__suspendTransform__${original}_${count}_${syntheticFun}" + } + private fun FirAnnotation.toTransformAnnotationData( markAnnotation: MarkAnnotation, sourceFunctionName: String @@ -852,11 +1048,10 @@ class SuspendTransformFirTransformer( )?.firstOrNull() private fun resolveReturnType( - original: FirSimpleFunction, - funData: FunData, + transformer: Transformer, returnTypeRef: FirTypeRef ): FirTypeRef { - val resultConeType = resolveReturnConeType(original, funData, returnTypeRef) + val resultConeType = resolveReturnConeType(transformer, returnTypeRef) return if (resultConeType is ConeErrorType) { buildErrorTypeRef { @@ -871,11 +1066,10 @@ class SuspendTransformFirTransformer( } private fun resolveReturnConeType( - original: FirSimpleFunction, - funData: FunData, + transformer: Transformer, returnTypeRef: FirTypeRef ): ConeKotlinType { - val transformer = funData.transformer + val transformer = transformer val returnType = transformer.transformReturnType ?: return returnTypeRef.coneType // OrNull // original.symbol.resolvedReturnType @@ -898,9 +1092,9 @@ class SuspendTransformFirTransformer( * @return function annotations `to` property annotations. */ private fun copyAnnotations( - original: FirSimpleFunction, funData: FunData, + original: FirSimpleFunction, syntheticFunData: SyntheticFunData, ): Pair, List> { - val transformer = funData.transformer + val transformer = syntheticFunData.transformer val (copyFunction, copyProperty, excludes, includes) = CopyAnnotationsData( transformer.copyAnnotationsToSyntheticFunction, @@ -941,22 +1135,6 @@ class SuspendTransformFirTransformer( addAll(copied) } - // try add @Generated(by = ...) -// runCatching { -// val generatedAnnotation = buildAnnotation { -// annotationTypeRef = buildResolvedTypeRef { -// type = generatedAnnotationClassId.createConeType(session) -// } -// argumentMapping = buildAnnotationArgumentMapping { -// includeGeneratedArguments(original) -// } -// } -// add(generatedAnnotation) -// }.getOrElse { e -> -// // Where is log? -// e.printStackTrace() -// } - // add includes includes.forEach { include -> val classId = include.classId diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt index 33a708f..cc53c85 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt @@ -1,10 +1,17 @@ package love.forte.plugin.suspendtrans.fir +import love.forte.plugin.suspendtrans.SuspendTransformBridgeFunDataFir import love.forte.plugin.suspendtrans.SuspendTransformUserDataFir import org.jetbrains.kotlin.GeneratedDeclarationKey -data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : GeneratedDeclarationKey() { +sealed class SuspendTransformGeneratedDeclarationKey() : GeneratedDeclarationKey() + +data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : + SuspendTransformGeneratedDeclarationKey() { override fun toString(): String { return "SuspendTransformPlugin(data=$data)" } } + +data class SuspendTransformBridgeFunctionKey(val data: SuspendTransformBridgeFunDataFir) : + SuspendTransformGeneratedDeclarationKey() diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index 43bbdae..a9646d4 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -1,6 +1,8 @@ package love.forte.plugin.suspendtrans.ir import love.forte.plugin.suspendtrans.* +import love.forte.plugin.suspendtrans.fir.SuspendTransformBridgeFunctionKey +import love.forte.plugin.suspendtrans.fir.SuspendTransformGeneratedDeclarationKey import love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext @@ -15,10 +17,7 @@ import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.builders.* import org.jetbrains.kotlin.ir.declarations.* -import org.jetbrains.kotlin.ir.expressions.IrBody -import org.jetbrains.kotlin.ir.expressions.IrCall -import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin -import org.jetbrains.kotlin.ir.expressions.IrTypeOperator +import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.impl.IrFunctionExpressionImpl import org.jetbrains.kotlin.ir.expressions.impl.IrTypeOperatorCallImpl import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol @@ -72,10 +71,10 @@ class SuspendTransformTransformer( val pluginKey = if (property != null) { // from property (property.origin as? IrDeclarationOrigin.GeneratedByPlugin) - ?.pluginKey as? SuspendTransformPluginKey + ?.pluginKey as? SuspendTransformGeneratedDeclarationKey } else { (declaration.origin as? IrDeclarationOrigin.GeneratedByPlugin) - ?.pluginKey as? SuspendTransformPluginKey + ?.pluginKey as? SuspendTransformGeneratedDeclarationKey } // K1 ? @@ -83,32 +82,66 @@ class SuspendTransformTransformer( val generatedOriginFunction: IrFunction? = when { pluginKey != null -> { - val callableFunction = - pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) - .firstOrNull() - ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") - resolveFunctionBody( - pluginKey, - declaration, - { f -> - pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) - }, - callableFunction - ).also { generatedOriginFunction -> - if (property != null) { - // NO! BACKING! FIELD! - property.backingField = null - } - - if (generatedOriginFunction != null) { - postProcessGenerateOriginFunction( - generatedOriginFunction, - pluginKey.data.transformer.originFunctionIncludeAnnotations + when (pluginKey) { + is SuspendTransformBridgeFunctionKey -> { + val callableFunction = + pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") + + resolveBridgeFunctionBody( + pluginKey, + declaration, + callableFunction ) + + null +// .also { generatedOriginFunction -> +// if (property != null) { +// // NO! BACKING! FIELD! +// property.backingField = null +// } +// +// if (generatedOriginFunction != null) { +// postProcessGenerateOriginFunction( +// generatedOriginFunction, +// pluginKey.data.transformer.originFunctionIncludeAnnotations +// ) +// } +// } } + is SuspendTransformPluginKey -> { + val callableFunction = + pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) + .firstOrNull() + ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found") + + resolveFunctionBody( + pluginKey, + declaration, + { f -> + pluginKey.data.originSymbol.checkSame(pluginKey.data.markerId, f) + }, + callableFunction + ).also { generatedOriginFunction -> + if (property != null) { + // NO! BACKING! FIELD! + property.backingField = null + } + + if (generatedOriginFunction != null) { + postProcessGenerateOriginFunction( + generatedOriginFunction, + pluginKey.data.transformer.originFunctionIncludeAnnotations + ) + } + } + } } + + } userData != null -> { @@ -159,6 +192,9 @@ class SuspendTransformTransformer( } } + /** + * @return origin function + */ @OptIn(ObsoleteDescriptorBasedAPI::class) private inline fun resolveFunctionBody( sourceKey: Any?, @@ -274,10 +310,25 @@ class SuspendTransformTransformer( return originFunction } - - return null } + + /** + * 直接为bridge fun生成body + */ + private fun resolveBridgeFunctionBody( + sourceKey: Any?, + function: IrFunction, + transformTargetFunctionCall: IrSimpleFunctionSymbol, + ) { + // body: return $transform(block, scope?) + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + null, + transformTargetFunctionCall + ) + } } private fun IrFunction.reportLocation(): CompilerMessageSourceLocation? { @@ -353,45 +404,54 @@ private fun generateTransformBodyForFunction( private fun generateTransformBodyForFunctionLambda( context: IrPluginContext, function: IrFunction, - originFunction: IrFunction, + originFunction: IrFunction?, transformTargetFunctionCall: IrSimpleFunctionSymbol, ): IrBody { - val originValueParameters = originFunction.valueParameters - function.valueParameters.forEachIndexed { index, parameter -> - val originFunctionValueParameter = originValueParameters[index] - parameter.defaultValue = originFunctionValueParameter.defaultValue + // 不为null,说明是直接生成。否则是bridge + originFunction?.valueParameters?.also { originValueParameters -> + function.valueParameters.forEachIndexed { index, parameter -> + val originFunctionValueParameter = originValueParameters[index] + parameter.defaultValue = originFunctionValueParameter.defaultValue + } } return context.createIrBuilder(function.symbol).irBlockBody { - val suspendLambdaFunc = context.createSuspendLambdaFunctionWithCoroutineScope( - originFunction = originFunction, - function = function - ) - val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) + val lambdaExpression: IrExpression = if (originFunction != null) { + val suspendLambdaFunc = context.createSuspendLambdaFunctionWithCoroutineScope( + originFunction = originFunction, + function = function + ) - +irReturn(irCall(transformTargetFunctionCall).apply { - putValueArgument( - 0, - IrFunctionExpressionImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - lambdaType, - suspendLambdaFunc, - IrStatementOrigin.LAMBDA - ) + val lambdaType = context.symbols.suspendFunctionN(0).typeWith(suspendLambdaFunc.returnType) + + IrFunctionExpressionImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + lambdaType, + suspendLambdaFunc, + IrStatementOrigin.LAMBDA ) - // argument: 1, if is CoroutineScope, and this is CoroutineScope. - val owner = transformTargetFunctionCall.owner + } else { + // is bridge fun, use the first param `block` + val blockParameter = function.valueParameters.first() + irGet(blockParameter) + } + + +irReturn(irCall(transformTargetFunctionCall).apply { + putValueArgument(0, lambdaExpression) + + val transformFunctionOwner = transformTargetFunctionCall.owner // CoroutineScope - val ownerValueParameters = owner.valueParameters + val ownerValueParameters = transformFunctionOwner.valueParameters + // argument: 1, if is CoroutineScope, and this is CoroutineScope. if (ownerValueParameters.size > 1) { for (index in 1..ownerValueParameters.lastIndex) { val valueParameter = ownerValueParameters[index] val type = valueParameter.type - tryResolveCoroutineScopeValueParameter(type, context, function, owner, this@irBlockBody, index) + tryResolveCoroutineScopeValueParameter(type, context, function, transformFunctionOwner, this@irBlockBody, index) } } diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt index 28748a7..2f441de 100644 --- a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/runners/AbstractCodeGenTestRunner.kt @@ -26,7 +26,7 @@ abstract class AbstractCodeGenTestRunner : AbstractTestRunner() { } configureJvmArtifactsHandlersStep { - useHandlers(::BytecodeListingHandler,::AsmLikeInstructionListingHandler, ) + useHandlers(::BytecodeListingHandler, ::AsmLikeInstructionListingHandler) } defaultDirectives { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt index a95caea..35c8c67 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.kt @@ -7,12 +7,13 @@ import kotlinx.coroutines.runBlocking import love.forte.plugin.suspendtrans.annotation.JvmAsync import love.forte.plugin.suspendtrans.annotation.JvmBlocking -public interface DeleteOption abstract class MyClass { @JvmBlocking @JvmAsync - suspend open fun deleteAll(vararg options: DeleteOption): Int { + suspend open fun deleteAll(option: Int): Int { return 1 } + } + diff --git a/local-helper/build.gradle.kts b/local-helper/build.gradle.kts new file mode 100644 index 0000000..a453725 --- /dev/null +++ b/local-helper/build.gradle.kts @@ -0,0 +1,59 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget + +plugins { + `java-library` + kotlin("multiplatform") +// id("love.forte.plugin.suspend-transform") + // id("suspend-transform.jvm-maven-publish") + // id(project(":suspend-transform-plugin-gradle")) +} + +repositories { + mavenCentral() +} + +kotlin { + jvmToolchain(8) + + jvm { + compilerOptions { + freeCompilerArgs.add("-Xjvm-default=all") + jvmTarget = JvmTarget.JVM_1_8 + } + + testRuns["test"].executionTask.configure { + useJUnitPlatform() + } + } + + js { + nodejs() + compilerOptions { + useEsModules() + // https://kotlinlang.org/docs/js-ir-compiler.html#output-mode + freeCompilerArgs.add("-Xir-per-file") + } + generateTypeScriptDefinitions() + binaries.library() + } + + macosX64() + linuxX64() + mingwX64() + + sourceSets { + commonMain { + dependencies { +// api(kotlin("reflect")) + api(libs.kotlinx.coroutines.core) + } + } + + jvmTest { + dependencies { + api(kotlin("test-junit5")) + } + } + } +} + diff --git a/local-helper/src/commonMain/kotlin/MyInterface.kt b/local-helper/src/commonMain/kotlin/MyInterface.kt new file mode 100644 index 0000000..0c24398 --- /dev/null +++ b/local-helper/src/commonMain/kotlin/MyInterface.kt @@ -0,0 +1,38 @@ +import kotlinx.coroutines.CoroutineScope +import kotlin.js.ExperimentalJsExport +import kotlin.js.JsExport + +/** + * + * @author ForteScarlet + */ +@JsExport +interface MyInterface { + + @JsExport.Ignore + suspend fun run(times: Int): Int + + @Suppress("NOTHING_TO_INLINE") + private inline fun __suspendTransform__run_0_runBlocking(noinline block: suspend () -> Int): Int { + return runBlocking(block, this as? CoroutineScope) + } + + fun runBlocking(times: Int): Int = __suspendTransform__run_0_runBlocking({ run(times) }) +} + +@JsExport +@OptIn(ExperimentalJsExport::class) +interface MyInterface2 : MyInterface { + @JsExport.Ignore + suspend fun run2(times: T): T + + @Suppress("NOTHING_TO_INLINE") + private inline fun __suspendTransform__run2_0_runBlocking(noinline block: suspend () -> T): T { + return runBlocking(block, this as? CoroutineScope) + } + + fun run2Blocking(value: T): T = __suspendTransform__run2_0_runBlocking({ run2(value) }) + +} + +fun runBlocking(block: suspend () -> T, scope: CoroutineScope?): T = TODO() diff --git a/settings.gradle.kts b/settings.gradle.kts index 8b9d276..717fd1b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,6 +27,8 @@ include(":runtime:suspend-transform-runtime") include(":plugins:suspend-transform-plugin-gradle") +include(":local-helper") + //Samples // include(":tests:test-jvm") // include(":tests:test-js") From 71a8ce4869d6f254f64f041fa3b0f5b510dfbac0 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 00:44:24 +0800 Subject: [PATCH 07/11] Refactoring K2 code generation logic --- buildSrc/src/main/kotlin/IProject.kt | 2 +- .../SuspendTransformConfiguration.kt | 6 +- .../fir/SuspendTransformFirTransformer.kt | 1305 ++++++++--------- .../fir/SuspendTransformPluginKey.kt | 5 + .../ir/SuspendTransformTransformer.kt | 25 +- .../plugin/suspendtrans/utils/FirUtils.kt | 69 +- .../runners/CodeGenTestRunnerGenerated.java | 6 + ...spendTransformerEnvironmentConfigurator.kt | 22 +- .../src/testData/codegen/alias.fir.ir.txt | 19 +- .../src/testData/codegen/alias.fir.txt | 16 +- .../testData/codegen/asProperty.fir.ir.txt | 81 +- .../src/testData/codegen/asProperty.fir.txt | 48 +- .../src/testData/codegen/basic.fir.ir.txt | 55 +- .../src/testData/codegen/basic.fir.txt | 45 +- .../testData/codegen/implOverriden.fir.ir.txt | 103 +- .../testData/codegen/implOverriden.fir.txt | 99 +- .../codegen/implOverridenGeneric.fir.ir.txt | 162 +- .../codegen/implOverridenGeneric.fir.txt | 162 +- .../src/testData/codegen/opt.fir.ir.txt | 19 +- .../src/testData/codegen/opt.fir.txt | 16 +- .../src/testData/codegen/override.fir.ir.txt | 38 +- .../src/testData/codegen/override.fir.txt | 32 +- .../src/testData/codegen/typeAttr.fir.ir.txt | 40 +- .../src/testData/codegen/typeAttr.fir.txt | 32 +- .../testData/codegen/typeAttrNested.asm.txt | 35 + .../codegen/typeAttrNested.fir.ir.txt | 77 + .../testData/codegen/typeAttrNested.fir.txt | 18 + .../src/testData/codegen/typeAttrNested.kt | 17 + .../src/testData/codegen/varargParam.asm.txt | 47 + .../testData/codegen/varargParam.fir.ir.txt | 64 + .../src/testData/codegen/varargParam.fir.txt | 25 + .../src/testData_2/codegen/alias.asm.txt | 49 + .../src/testData_2/codegen/alias.fir.ir.txt | 64 + .../src/testData_2/codegen/alias.fir.txt | 16 + .../src/testData_2/codegen/alias.kt | 16 + .../src/testData_2/codegen/asProperty.asm.txt | 141 ++ .../testData_2/codegen/asProperty.fir.ir.txt | 199 +++ .../src/testData_2/codegen/asProperty.fir.txt | 43 + .../src/testData_2/codegen/asProperty.kt | 27 + .../src/testData_2/codegen/basic.asm.txt | 125 ++ .../src/testData_2/codegen/basic.fir.ir.txt | 192 +++ .../src/testData_2/codegen/basic.fir.txt | 49 + .../src/testData_2/codegen/basic.kt | 30 + .../testData_2/codegen/implOverriden.asm.txt | 297 ++++ .../codegen/implOverriden.fir.ir.txt | 480 ++++++ .../testData_2/codegen/implOverriden.fir.txt | 127 ++ .../src/testData_2/codegen/implOverriden.kt | 74 + .../codegen/implOverridenGeneric.asm.txt | 449 ++++++ .../codegen/implOverridenGeneric.fir.ir.txt | 669 +++++++++ .../codegen/implOverridenGeneric.fir.txt | 145 ++ .../codegen/implOverridenGeneric.kt | 83 ++ .../src/testData_2/codegen/opt.asm.txt | 53 + .../src/testData_2/codegen/opt.fir.ir.txt | 122 ++ .../src/testData_2/codegen/opt.fir.txt | 34 + .../src/testData_2/codegen/opt.kt | 27 + .../src/testData_2/codegen/override.asm.txt | 131 ++ .../testData_2/codegen/override.fir.ir.txt | 238 +++ .../src/testData_2/codegen/override.fir.txt | 53 + .../src/testData_2/codegen/override.kt | 29 + .../src/testData_2/codegen/typeAttr.asm.txt | 121 ++ .../testData_2/codegen/typeAttr.fir.ir.txt | 218 +++ .../src/testData_2/codegen/typeAttr.fir.txt | 47 + .../src/testData_2/codegen/typeAttr.kt | 32 + .../testData_2/codegen/typeAttrNested.asm.txt | 35 + .../codegen/typeAttrNested.fir.ir.txt | 77 + .../testData_2/codegen/typeAttrNested.fir.txt | 18 + .../src/testData_2/codegen/typeAttrNested.kt | 17 + .../testData_2/codegen/varargParam.asm.txt | 47 + .../testData_2/codegen/varargParam.fir.ir.txt | 64 + .../testData_2/codegen/varargParam.fir.txt | 25 + .../src/testData_2/codegen/varargParam.kt | 19 + tests/test-js/build.gradle.kts | 19 +- ...ropertyTests.kt => AsPropertyInterface.kt} | 0 tests/test-js/src/jsMain/kotlin/Main.kt | 9 +- .../src/jsTest/kotlin/AsPropertyTest.kt | 21 + .../test-js/src/jsTest/kotlin/PromiseTest.kt | 21 + tests/test-jvm/build.gradle.kts | 2 +- .../suspendtrans/sample/AcceptSupport.kt | 44 + .../suspendtrans/sample/ApiExecutable.kt | 3 + .../src/test/kotlin/SuspendTransformTests.kt | 34 +- 80 files changed, 6348 insertions(+), 1177 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt create mode 100644 compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt rename tests/test-js/src/jsMain/kotlin/{AsPropertyTests.kt => AsPropertyInterface.kt} (100%) create mode 100644 tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt create mode 100644 tests/test-js/src/jsTest/kotlin/PromiseTest.kt create mode 100644 tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index 0ab86b8..bb76690 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -11,7 +11,7 @@ object IProject : ProjectDetail() { // Remember the libs.versions.toml! val ktVersion = "2.1.0" - val pluginVersion = "0.10.2" + val pluginVersion = "0.11.0" override val version: String = "$ktVersion-$pluginVersion" diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt index 82d4563..e5b46af 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt @@ -5,7 +5,8 @@ import kotlinx.serialization.Serializable @Serializable data class FunctionInfo( var packageName: String, - var className: String?, + @Deprecated("Top-Level function supported only") + var className: String? = null, var functionName: String, ) @@ -162,8 +163,11 @@ open class SuspendTransformConfiguration { /** * 在 K2 中,用于使 IR 的合成函数可以定位到 FIR 中原始函数的辅助注解。 * + * 昙花一现,在 `*-0.11.0` 之后不再需要此类过渡用注解。 + * * @since *-0.10.0 */ + @Deprecated("Unused after *-0.11.0") open var targetMarker: ClassInfo? = targetMarkerClassInfo open fun clear() { diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 1e58b28..1b5665c 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -2,9 +2,7 @@ package love.forte.plugin.suspendtrans.fir import love.forte.plugin.suspendtrans.* import love.forte.plugin.suspendtrans.utils.* -import org.jetbrains.kotlin.descriptors.EffectiveVisibility import org.jetbrains.kotlin.descriptors.Modality -import org.jetbrains.kotlin.descriptors.Visibilities import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.context.MutableCheckerContext @@ -20,11 +18,7 @@ import org.jetbrains.kotlin.fir.declarations.utils.isFinal import org.jetbrains.kotlin.fir.declarations.utils.isOverride import org.jetbrains.kotlin.fir.declarations.utils.isSuspend import org.jetbrains.kotlin.fir.declarations.utils.modality -import org.jetbrains.kotlin.fir.deserialization.replaceName -import org.jetbrains.kotlin.fir.expressions.FirAnnotation -import org.jetbrains.kotlin.fir.expressions.FirExpression -import org.jetbrains.kotlin.fir.expressions.FirLiteralExpression -import org.jetbrains.kotlin.fir.expressions.buildResolvedArgumentList +import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.* import org.jetbrains.kotlin.fir.expressions.impl.buildSingleExpressionBlock import org.jetbrains.kotlin.fir.extensions.FirDeclarationGenerationExtension @@ -35,9 +29,12 @@ import org.jetbrains.kotlin.fir.plugin.createConeType import org.jetbrains.kotlin.fir.references.builder.buildExplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildImplicitThisReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.* +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl +import org.jetbrains.kotlin.fir.resolve.getSuperTypes +import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider +import org.jetbrains.kotlin.fir.resolve.toRegularClassSymbol import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve -import org.jetbrains.kotlin.fir.resolve.transformers.ScopeClassDeclaration import org.jetbrains.kotlin.fir.scopes.impl.FirClassDeclaredMemberScope import org.jetbrains.kotlin.fir.scopes.impl.toConeType import org.jetbrains.kotlin.fir.scopes.processAllFunctions @@ -46,27 +43,27 @@ import org.jetbrains.kotlin.fir.symbols.SymbolInternals import org.jetbrains.kotlin.fir.symbols.impl.* import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.types.builder.buildErrorTypeRef -import org.jetbrains.kotlin.fir.types.builder.buildFunctionTypeRef import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef -import org.jetbrains.kotlin.name.CallableId -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.name.* import org.jetbrains.kotlin.platform.isCommon import org.jetbrains.kotlin.platform.isJs import org.jetbrains.kotlin.platform.isWasm import org.jetbrains.kotlin.platform.jvm.isJvm import org.jetbrains.kotlin.platform.konan.isNative -import org.jetbrains.kotlin.types.ConstantValueKind -import java.util.* +import org.jetbrains.kotlin.utils.keysToMap import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.atomic.AtomicInteger private data class CopiedTypeParameterPair( val original: FirTypeParameter, val copied: FirTypeParameter ) +private data class CopyAnnotations( + val functionAnnotations: List, + val propertyAnnotations: List, + val toOriginalAnnotations: List +) + /** * * @author ForteScarlet @@ -75,45 +72,76 @@ class SuspendTransformFirTransformer( session: FirSession, private val suspendTransformConfiguration: SuspendTransformConfiguration ) : FirDeclarationGenerationExtension(session) { - private val targetMarkerValueName = Name.identifier("value") - private val targetMarkerAnnotation = suspendTransformConfiguration.targetMarker?.toClassId() + + private val transformerFunctionSymbolMap = ConcurrentHashMap() + + private lateinit var coroutineScopeSymbol: FirClassLikeSymbol<*> private data class FirCacheKey( val classSymbol: FirClassSymbol<*>, val memberScope: FirClassDeclaredMemberScope? ) - private sealed class FunData { - abstract val funName: Name - abstract val transformer: Transformer - abstract val annotationData: TransformAnnotationData + private data class SyntheticFunData( + val funName: Name, + val annotationData: TransformAnnotationData, + val transformer: Transformer, + val transformerFunctionSymbol: FirNamedFunctionSymbol, + ) + + private fun initScopeSymbol() { + coroutineScopeSymbol = session.symbolProvider.getClassLikeSymbolByClassId( + ClassId( + FqName.fromSegments(listOf("kotlinx", "coroutines")), + Name.identifier("CoroutineScope") + ) + ) ?: error("Cannot resolve `kotlinx.coroutines.CoroutineScope` symbol.") } - // synthetic fun 需要知道 bridge fun, 反之则不需要 + private fun initTransformerFunctionSymbolMap() { + // 尝试找到所有配置的 bridge function, 例如 `runBlocking` 等 + suspendTransformConfiguration.transformers + .forEach { (_, transformerList) -> + for (transformer in transformerList) { + val transformFunctionInfo = transformer.transformFunctionInfo + val packageName = transformFunctionInfo.packageName + val functionName = transformFunctionInfo.functionName + @Suppress("DEPRECATION") + val className = transformFunctionInfo.className + if (className != null) { + error( + "Not support `className` (`$className`) in transformer function info: " + + "top level function supported only." + ) + } - private data class SyntheticFunData( - override val funName: Name, - val bridgeFunData: BridgeFunData, - ) : FunData() { - override val annotationData: TransformAnnotationData - get() = bridgeFunData.annotationData - override val transformer: Transformer - get() = bridgeFunData.transformer - } + // TODO 校验funcs? - private data class BridgeFunData( - override val funName: Name, - val symbol: FirNamedFunctionSymbol, - val target: FirFunctionTarget, - val lambdaParameter: FirValueParameter, - val returnType: FirTypeRef, - override val annotationData: TransformAnnotationData, - override val transformer: Transformer, - ) : FunData() + val transformerFunctionSymbols = + session.symbolProvider.getTopLevelFunctionSymbols( + packageName.fqn, + Name.identifier(functionName) + ) + + if (transformerFunctionSymbols.isNotEmpty()) { + if (transformerFunctionSymbols.size == 1) { + transformerFunctionSymbolMap[transformer] = transformerFunctionSymbols.first() + } else { + error("Found multiple transformer function symbols for transformer: $transformer") + } + } else { + error("Cannot find transformer function symbol for transformer: $transformer") + } + } + } + } // private val cache: FirCache, FirClassDeclaredMemberScope?>, Map>?, Nothing?> = - private val cache: FirCache>?, Nothing?> = + private val cache: FirCache>?, Nothing?> = session.firCachesFactory.createCache { (symbol, scope), c -> + initScopeSymbol() + initTransformerFunctionSymbolMap() + createCache(symbol, scope) } @@ -122,7 +150,6 @@ class SuspendTransformFirTransformer( val names = mutableSetOf() cache.getValue(FirCacheKey(classSymbol, context.declaredScope))?.forEach { (_, map) -> -// map.values.forEach { names.add(Name.identifier(it.annotationData.functionName)) } map.values.forEach { names.add(it.funName) } } @@ -135,29 +162,12 @@ class SuspendTransformFirTransformer( holder, ReturnTypeCalculatorForFullBodyResolve.Default, ) - private val expectActualContext = session.expectActualMatchingContextFactory.create(session, scope) - - /** - * 根据函数的名称、参数列表的各参数的类型计算一个hash字符串。 - */ - private fun FirSimpleFunction.calculateOriginFuncHash(): String { - val str = buildString { - append(name.asString()) - append(dispatchReceiverType.toString()) - append(receiverParameter?.typeRef?.coneTypeOrNull.toString()) - valueParameters.forEach { vp -> - append(vp.returnTypeRef.coneTypeOrNull.toString()) - } - } - - return Base64.getEncoder().encodeToString(str.toByteArray()) - } - private fun FirSimpleFunctionBuilder.copyParameters() { - val funSymbol = symbol - val originalTypeParameterCache = mutableListOf() - - val newTypeParameters = typeParameters.map { + private fun List.mapToNewTypeParameters( + funSymbol: FirBasedSymbol<*>, + originalTypeParameterCache: MutableList + ): List { + return map { buildTypeParameterCopy(it) { containingDeclarationSymbol = funSymbol // it.containingDeclarationSymbol // symbol = it.symbol // FirTypeParameterSymbol() @@ -166,10 +176,12 @@ class SuspendTransformFirTransformer( originalTypeParameterCache.add(CopiedTypeParameterPair(it, new)) } } - typeParameters.clear() - typeParameters.addAll(newTypeParameters) + } - val newValueParameters = valueParameters.map { vp -> + private fun List.mapToNewValueParameters( + originalTypeParameterCache: MutableList + ): List { + return map { vp -> buildValueParameterCopy(vp) { symbol = FirValueParameterSymbol(vp.symbol.name) @@ -181,139 +193,70 @@ class SuspendTransformFirTransformer( } } } + } + + private fun FirReceiverParameter.copyToNew(originalTypeParameterCache: MutableList): FirReceiverParameter? { + return typeRef.coneTypeOrNull + ?.copyWithTypeParameters(originalTypeParameterCache) + ?.let { foundCopied -> + buildReceiverParameterCopy(this) { + typeRef = typeRef.withReplacedConeType(foundCopied) + } + } + } + + + private fun ConeKotlinType.copyConeType(originalTypeParameterCache: MutableList): ConeKotlinType? { + return copyWithTypeParameters(originalTypeParameterCache) + } + + private fun ConeKotlinType.copyConeTypeOrSelf(originalTypeParameterCache: MutableList): ConeKotlinType { + return copyConeType(originalTypeParameterCache) ?: this + } + + private fun FirSimpleFunctionBuilder.copyParameters() { + val originalTypeParameterCache = mutableListOf() + + val newTypeParameters = typeParameters.mapToNewTypeParameters(symbol, originalTypeParameterCache) + typeParameters.clear() + typeParameters.addAll(newTypeParameters) + + val newValueParameters = valueParameters.mapToNewValueParameters(originalTypeParameterCache) valueParameters.clear() valueParameters.addAll(newValueParameters) - receiverParameter?.also { receiverParameter -> - receiverParameter.typeRef.coneTypeOrNull - ?.copyWithTypeParameters(originalTypeParameterCache) - ?.also { foundCopied -> - this.receiverParameter = buildReceiverParameterCopy(receiverParameter) { - typeRef = typeRef.withReplacedConeType(foundCopied) - } - } + receiverParameter?.copyToNew(originalTypeParameterCache)?.also { + this.receiverParameter = it } val coneTypeOrNull = returnTypeRef.coneTypeOrNull if (coneTypeOrNull != null) { - returnTypeRef = returnTypeRef.withReplacedConeType( - coneTypeOrNull - .copyWithTypeParameters(originalTypeParameterCache) - ?: coneTypeOrNull, - ) + returnTypeRef = returnTypeRef + .withReplacedConeType(coneTypeOrNull.copyConeTypeOrSelf(originalTypeParameterCache)) } } -// private fun FirSimpleFunction.copySyntheticFun( -// owner: FirClassSymbol<*>, -// callableId: CallableId -// ): FirSimpleFunction { -// val origin = this -// -// val marker = buildValueParameter { -// source = origin.source -// moduleData = origin.moduleData -// this.origin = origin.origin -// returnTypeRef = buildResolvedTypeRef { -// coneType = StandardTypes.Int -// source = null -// } -// name = Name.identifier("__test_marker") -// symbol = FirValueParameterSymbol(name) -// defaultValue = buildLiteralExpression(null, ConstantValueKind.Int, 1, null, setType = true) -// containingFunctionSymbol = origin.symbol -// backingField = null -// isCrossinline = false -// isNoinline = false -// isVararg = false -// } -// -// val syntheticFun = buildSimpleFunctionCopy(this) { -// this.origin = FirDeclarationOrigin.Synthetic.FakeFunction -// name = callableId.callableName -// symbol = FirNamedFunctionSymbol(callableId) -// status = origin.status.copy( -// modality = Modality.OPEN, -// isOverride = false, -// visibility = Visibilities.Public -// ) -// -// copyParameters() -// -// this.valueParameters.add(0, marker) -// -// val builder = this -// -// body = buildSingleExpressionBlock( -// buildReturnExpression { -// target = FirFunctionTarget(null, false) -// result = buildFunctionCall { -// source = origin.source -// calleeReference = buildResolvedNamedReference { -// source = origin.source -// name = origin.name -// resolvedSymbol = origin.symbol -// } -// // TODO contextReceiverArguments -// -// argumentList = buildResolvedArgumentList( -// null, -// builder.valueParameters.associateByTo(LinkedHashMap()) { valueParameter -> -// buildCallableReferenceAccess { -// source = valueParameter.source -// calleeReference = buildResolvedNamedReference { -// source = valueParameter.source -// name = valueParameter.name -// resolvedSymbol = valueParameter.symbol -// } -// coneTypeOrNull = valueParameter.returnTypeRef.coneTypeOrNull -// } -// }) -// } -// } -// ) -// -// } -// -// syntheticFun.excludeFromJsExport(session) -// syntheticFun.jvmSynthetic(session) -// -// return syntheticFun -// } - - private fun FirSimpleFunction.appendTargetMarker(markerId: String) { - if (targetMarkerAnnotation != null) { - if (annotations.none { - it.fqName(session) == targetMarkerAnnotation.asSingleFqName() - && (it.argumentMapping.mapping[targetMarkerValueName] as? FirLiteralExpression) - ?.value == markerId - }) { - replaceAnnotations( - buildList { - addAll(annotations) - add(buildAnnotation { - argumentMapping = buildAnnotationArgumentMapping { - mapping[Name.identifier("value")] = buildLiteralExpression( - null, - ConstantValueKind.String, - markerId, - null, - true, - null - ) - } - annotationTypeRef = buildResolvedTypeRef { - coneType = targetMarkerAnnotation.createConeType(session) - } - }) - } - ) + private fun FirPropertyAccessorBuilder.copyParameters( + originalTypeParameterCache: MutableList = mutableListOf(), + copyReturnType: Boolean = true + ) { + val newTypeParameters = typeParameters.mapToNewTypeParameters(symbol, originalTypeParameterCache) + typeParameters.clear() + typeParameters.addAll(newTypeParameters) + + val newValueParameters = valueParameters.mapToNewValueParameters(originalTypeParameterCache) + valueParameters.clear() + valueParameters.addAll(newValueParameters) + + if (copyReturnType) { + val coneTypeOrNull = returnTypeRef.coneTypeOrNull + if (coneTypeOrNull != null) { + returnTypeRef = returnTypeRef + .withReplacedConeType(coneTypeOrNull.copyConeTypeOrSelf(originalTypeParameterCache)) } } - } - @OptIn(SymbolInternals::class) override fun generateFunctions( callableId: CallableId, context: MemberGenerationContext? @@ -326,103 +269,225 @@ class SuspendTransformFirTransformer( val funList = arrayListOf() funcMap.forEach { (func, funData) -> - when (funData) { - is BridgeFunData -> { - generateBridgeFunctions( - callableId, - context, - owner, - func, - funData, - funList, - ) - } - - is SyntheticFunData -> { - generateSyntheticFunctions( - callableId, - context, - owner, - func, - funData, - funList, - ) - } - } + generateSyntheticFunctions( + callableId, + owner, + func, + funData, + funList, + ) } return funList } - private fun generateBridgeFunctions( - callableId: CallableId, - context: MemberGenerationContext?, - owner: FirClassSymbol<*>, + + @OptIn(SymbolInternals::class) + private fun generateSyntheticFunctionBody( + originFunc: FirSimpleFunction, originFunSymbol: FirNamedFunctionSymbol, - funData: BridgeFunData, - results: MutableList, - ) { - // private inline fun $name(block: suspend () -> T): returnType // IR -> {} - val key = SuspendTransformBridgeFunctionKey( - data = SuspendTransformBridgeFunDataFir( - asProperty = false, - transformer = funData.transformer - ) - ) + owner: FirClassSymbol<*>, + thisContextReceivers: MutableList, + thisReceiverParameter: FirReceiverParameter?, + newFunSymbol: FirBasedSymbol<*>, + thisValueParameters: MutableList, + bridgeFunSymbol: FirNamedFunctionSymbol, + newFunTarget: FirFunctionTarget, + transformer: Transformer + ): FirBlock = buildBlock { + this.source = originFunc.body?.source + + // lambda: suspend () -> T + val lambdaTarget = FirFunctionTarget(null, isLambda = true) + val lambda = buildAnonymousFunction { + this.resolvePhase = FirResolvePhase.BODY_RESOLVE + this.isLambda = true + this.moduleData = originFunSymbol.moduleData + this.origin = FirDeclarationOrigin.Synthetic.FakeFunction + this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef + this.hasExplicitParameterList = false + this.status = FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION + this.symbol = FirAnonymousFunctionSymbol() + this.body = buildSingleExpressionBlock( + buildReturnExpression { + target = lambdaTarget + result = buildFunctionCall { + // Call original fun + this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType + this.source = originFunSymbol.source + this.calleeReference = buildResolvedNamedReference { + this.source = originFunSymbol.source + this.name = originFunSymbol.name + this.resolvedSymbol = originFunSymbol + } + + val originValueParameters = originFunc.valueParameters + + this.dispatchReceiver = buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + } + + // TODO? + this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> + buildThisReceiverExpression { + coneTypeOrNull = receiver.typeRef.coneTypeOrNull + source = receiver.source + calleeReference = buildExplicitThisReference { + source = receiver.source + labelName = receiver.labelName?.asString() + } + } + }) + + // TODO What is explicitReceiver? + this.extensionReceiver = thisReceiverParameter?.let { thisReceiverParameter -> + buildThisReceiverExpression { + coneTypeOrNull = thisReceiverParameter.typeRef.coneTypeOrNull + source = thisReceiverParameter.source + calleeReference = buildImplicitThisReference { + boundSymbol = newFunSymbol + } + } + } - val bridgeFun = buildSimpleFunction { - name = funData.funName - source = originFunSymbol.source - moduleData = originFunSymbol.moduleData - // see FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_STATUSLESS_DECLARATIONS - status = FirResolvedDeclarationStatusImpl( - Visibilities.Private, - Modality.FINAL, - EffectiveVisibility.PrivateInClass - ).copy( - visibility = Visibilities.Private, - modality = Modality.FINAL, - isOverride = false, - isSuspend = false, - isInline = true, + if (thisValueParameters.isNotEmpty()) { + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + thisValueParameters.forEachIndexed { index, thisParam -> + val qualifiedAccess = thisParam.toQualifiedAccess() + put(qualifiedAccess, originValueParameters[index]) + } + } + ) + } + } + } ) - returnTypeRef = funData.returnType - receiverParameter = null - containerSource = originFunSymbol.containerSource - dispatchReceiverType = originFunSymbol.dispatchReceiverType - // TODO 泛型需不需要处理? - valueParameters.add(funData.lambdaParameter) - body = null - symbol = funData.symbol - - // TODO 仅保留跟 originFun.returnType 一样或相关的 type parameter? -// val returnConeType = originFunSymbol.resolvedReturnTypeRef.coneType -// originFunSymbol.typeParameterSymbols.find { originTypeParameterSymbol -> -// returnConeType.copyWithTypeParameters() -// originTypeParameterSymbol -// TODO() -// } - - origin = key.origin + + this.typeRef = buildResolvedTypeRef { + this.coneType = StandardClassIds.SuspendFunctionN(0) + .createConeType(session, arrayOf(originFunSymbol.resolvedReturnType)) + } } + lambdaTarget.bind(lambda) - bridgeFun.jvmSynthetic(session) + val returnType = resolveReturnType(transformer, originFunc.returnTypeRef) - funData.target.bind(bridgeFun) + this.statements.add( + buildReturnExpression { + this.target = newFunTarget + this.result = buildFunctionCall { + this.coneTypeOrNull = returnType.coneType + this.source = originFunc.body?.source + this.calleeReference = buildResolvedNamedReference { + this.source = bridgeFunSymbol.source + this.name = bridgeFunSymbol.name + this.resolvedSymbol = bridgeFunSymbol + } + + // this.dispatchReceiver = buildThisReceiverExpression { + // coneTypeOrNull = originFunSymbol.dispatchReceiverType + // source = originFunSymbol.source + // calleeReference = buildImplicitThisReference { + // boundSymbol = owner + // } + // } + + this.argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put( + buildAnonymousFunctionExpression { + source = null + anonymousFunction = lambda + isTrailingLambda = false + }, + // funData.bridgeFunData.lambdaParameter + bridgeFunSymbol.valueParameterSymbols.first().fir + ) + + // scope, if exists + val valueParameterSymbols = + bridgeFunSymbol.valueParameterSymbols + + if (valueParameterSymbols.size > 1) { + val secondParameter = valueParameterSymbols[1] + + val secondParameterType = secondParameter.resolvedReturnType + val secondParameterTypeNotNullable = + secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) + + val isCoroutineScope = secondParameterTypeNotNullable.isSubtypeOf( + coroutineScopeSymbol.toLookupTag().constructClassType(), + session, + ) + + if (isCoroutineScope) { + if (secondParameterType.isMarkedNullable) { + // this as? CoroutineScope + + val secondParameterTypeNotNullable = + secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull( + session.typeContext + ) + + put( + buildTypeOperatorCall { + source = originFunSymbol.source + coneTypeOrNull = secondParameterTypeNotNullable + argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put( + buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + }, + secondParameter.fir + ) + } + ) + operation = FirOperation.SAFE_AS + conversionTypeRef = + secondParameterTypeNotNullable.toFirResolvedTypeRef() + + }, + secondParameter.fir + ) + + } else { + // this as CoroutineScope + // or throw error? + + } + + } + } - results.add(bridgeFun.symbol) + } + ) + } + } + ) } @OptIn(SymbolInternals::class) private fun generateSyntheticFunctions( callableId: CallableId, - context: MemberGenerationContext?, owner: FirClassSymbol<*>, originFunSymbol: FirNamedFunctionSymbol, funData: SyntheticFunData, results: MutableList, ) { - val bridgeFunData = funData.bridgeFunData + val realBridgeFunSymbol = funData.transformerFunctionSymbol val annotationData = funData.annotationData if (!annotationData.asProperty) { @@ -433,33 +498,25 @@ class SuspendTransformFirTransformer( // generate val originFunc = originFunSymbol.fir - val uniqueFunHash = originFunc.calculateOriginFuncHash() - - // TODO 生成一个合成函数用来代替 originFunc, 然后其他生成的桥接函数都使用这个合成的函数而不是源函数。 - -// val syntheticFunCallableName = callableId.callableName.asString() + "-f-${uniqueFunHash}" -// val syntheticFunName = callableId.copy(Name.identifier(syntheticFunCallableName)) -// val syntheticFun = originFunc.copySyntheticFun(owner, callableId) -// funList.add(syntheticFun.symbol) - - val (functionAnnotations, _) = copyAnnotations(originFunc, funData) + val (functionAnnotations, _, includeToOriginal) = copyAnnotations(originFunc, funData) val newFunSymbol = FirNamedFunctionSymbol(callableId) - val key = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = originFunc.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = originFunc.typeParameters, - valueParameters = originFunc.valueParameters, - originFunc.returnTypeRef.coneTypeOrNull?.classId, - session, - ), - asProperty = false, - transformer = funData.transformer - ) - ) +// val key = SuspendTransformPluginKey( +// data = SuspendTransformUserDataFir( +// markerId = UUID.randomUUID().toString(), +// originSymbol = originFunc.symbol.asOriginSymbol( +// targetMarkerAnnotation, +// typeParameters = originFunc.typeParameters, +// valueParameters = originFunc.valueParameters, +// originFunc.returnTypeRef.coneTypeOrNull?.classId, +// session, +// ), +// asProperty = false, +// transformer = funData.transformer +// ) +// ) + val key = SuspendTransformK2V3Key val newFunTarget = FirFunctionTarget(null, isLambda = false) val newFun = buildSimpleFunctionCopy(originFunc) { @@ -478,6 +535,10 @@ class SuspendTransformFirTransformer( ), ) +// val returnType = resolveReturnType(originFunc, funData, returnTypeRef) +// returnTypeRef = returnType +// returnTypeRef = funData.bridgeFunData.returnType + // Copy the typeParameters. // Otherwise, in functions like the following, an error will occur // suspend fun data(value: A): T = ... @@ -485,10 +546,11 @@ class SuspendTransformFirTransformer( // In the generated IR, data and dataBlocking will share an `A`, generating the error. // The error: Duplicate IR node // [IR VALIDATION] JvmIrValidationBeforeLoweringPhase: Duplicate IR node: TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false of FUN GENERATED[...] - // TODO copy to value parameters, receiver and - // return type? copyParameters() + // resolve returnType (with wrapped) after copyParameters + returnTypeRef = resolveReturnType(funData.transformer, returnTypeRef) + val thisReceiverParameter = this.receiverParameter val thisContextReceivers = this.contextReceivers val thisValueParameters = this.valueParameters @@ -496,139 +558,27 @@ class SuspendTransformFirTransformer( annotations.clear() annotations.addAll(functionAnnotations) - returnTypeRef = funData.bridgeFunData.returnType - - /* - * __suspendTransform__run_0_runBlocking({ run(times) }) - */ - - body = buildBlock { - this.source = originFunc.body?.source - - // lambda: suspend () -> T - val lambdaTarget = FirFunctionTarget(null, isLambda = true) - val lambda = buildAnonymousFunction { - this.isLambda = true - this.moduleData = originFunSymbol.moduleData -// this.origin = key.origin - this.origin = FirDeclarationOrigin.Synthetic.FakeFunction - this.returnTypeRef = originFunSymbol.resolvedReturnTypeRef - this.hasExplicitParameterList = false - this.status = - FirResolvedDeclarationStatusImpl.DEFAULT_STATUS_FOR_SUSPEND_FUNCTION_EXPRESSION - this.symbol = FirAnonymousFunctionSymbol() - this.body = buildSingleExpressionBlock( - buildReturnExpression { - target = lambdaTarget - result = buildFunctionCall { - // Call original fun - this.coneTypeOrNull = originFunSymbol.resolvedReturnTypeRef.coneType - this.source = originFunSymbol.source - this.calleeReference = buildResolvedNamedReference { - this.source = originFunSymbol.source - this.name = originFunSymbol.name - this.resolvedSymbol = originFunSymbol - } - - val originValueParameters = originFunc.valueParameters - - this.dispatchReceiver = buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType - source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } - } - - // TODO? - this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> - buildThisReceiverExpression { - coneTypeOrNull = receiver.typeRef.coneTypeOrNull - source = receiver.source - calleeReference = buildExplicitThisReference { - source = receiver.source - labelName = receiver.labelName?.asString() - } - } - }) - - // TODO? - this.explicitReceiver = thisReceiverParameter?.let { thisExplicitReceiver -> - buildThisReceiverExpression { - coneTypeOrNull = thisExplicitReceiver.typeRef.coneTypeOrNull - source = thisExplicitReceiver.source - calleeReference = buildExplicitThisReference { - source = thisExplicitReceiver.source - } - } - } - - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - thisValueParameters.forEachIndexed { index, thisParam -> - val qualifiedAccess = thisParam.toQualifiedAccess() - put(qualifiedAccess, originValueParameters[index]) - } - } - ) - } - } - ) - - this.typeRef = bridgeFunData.lambdaParameter.returnTypeRef - } - lambdaTarget.bind(lambda) - - // bind to bridge fun - - this.statements.add( - buildReturnExpression { - this.target = newFunTarget - this.result = buildFunctionCall { - this.coneTypeOrNull = bridgeFunData.returnType.coneType - this.source = bridgeFunData.symbol.source - this.calleeReference = buildResolvedNamedReference { - this.source = bridgeFunData.symbol.source - this.name = bridgeFunData.symbol.name - this.resolvedSymbol = bridgeFunData.symbol - } - - this.dispatchReceiver = buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType - source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } - } - - this.argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - put(buildAnonymousFunctionExpression { - source = null - anonymousFunction = lambda - isTrailingLambda = false - }, funData.bridgeFunData.lambdaParameter) - } - ) - } - } - ) - } - // body = null + body = generateSyntheticFunctionBody( + originFunc, + originFunSymbol, + owner, + thisContextReceivers, + thisReceiverParameter, + newFunSymbol, + thisValueParameters, + realBridgeFunSymbol, + newFunTarget, + funData.transformer + ) origin = key.origin } - if (targetMarkerAnnotation != null) { - originFunc.appendTargetMarker(uniqueFunHash) - } - - // TODO 在原函数上附加的annotations - newFunTarget.bind(newFun) results.add(newFun.symbol) + + // 在原函数上附加的annotations + originFunc.includeAnnotations(includeToOriginal) } } @@ -645,153 +595,152 @@ class SuspendTransformFirTransformer( val propList = mutableListOf() for ((originalFunSymbol, funData) in funcMap) { - if (funData !is SyntheticFunData) { + val annotationData = funData.annotationData + + if (!annotationData.asProperty) { continue } - val annotationData = funData.annotationData - if (annotationData.asProperty) { - val isOverride = - checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) - - // generate - val original = originalFunSymbol.fir - - val uniqueFunHash = original.calculateOriginFuncHash() - - val (functionAnnotations, propertyAnnotations) = - copyAnnotations(original, funData) - - // val p = createMemberProperty() - // owner = owner, - // key = SuspendTransformPluginKey( - // data = SuspendTransformUserDataFir( - // originSymbol = original.symbol.asOriginSymbol( - // typeParameters = original.typeParameters, - // valueParameters = original.valueParameters, - // original.returnTypeRef.coneTypeOrNull?.classId - // ), - // asProperty = true, - // transformer = funData.transformer - // ) - // ), - // name = callableId.callableName, - // returnTypeProvider = { resolveReturnConeType(original, funData) }, - // isVal = true, - // hasBackingField = false, - // ) { - // modality = original.syntheticModifier ?: Modality.FINAL - // // TODO receiver? - //// val receiverType = original.receiverParameter?.typeRef?.coneTypeOrNull - //// if (receiverType != null) { - //// extensionReceiverType(receiverType) - //// } - // } - - val pSymbol = FirPropertySymbol(callableId) - val pKey = SuspendTransformPluginKey( - data = SuspendTransformUserDataFir( - markerId = uniqueFunHash, - originSymbol = original.symbol.asOriginSymbol( - targetMarkerAnnotation, - typeParameters = original.typeParameters, - valueParameters = original.valueParameters, - original.returnTypeRef.coneTypeOrNull?.classId, - session - ), - asProperty = true, - transformer = funData.transformer - ) - ) + val isOverride = + checkSyntheticFunctionIsOverrideBasedOnSourceFunction(funData, originalFunSymbol, checkContext) + // generate + val original = originalFunSymbol.fir + + val (functionAnnotations, propertyAnnotations, includeToOriginal) = + copyAnnotations(original, funData) + + val pSymbol = FirPropertySymbol(callableId) + +// val pKey = SuspendTransformPluginKey( +// data = SuspendTransformUserDataFir( +// markerId = uniqueFunHash, +// originSymbol = original.symbol.asOriginSymbol( +// targetMarkerAnnotation, +// typeParameters = original.typeParameters, +// valueParameters = original.valueParameters, +// original.returnTypeRef.coneTypeOrNull?.classId, +// session +// ), +// asProperty = true, +// transformer = funData.transformer +// ) +// ) + val pKey = SuspendTransformK2V3Key + + val originalReturnType = original.returnTypeRef + + val originalTypeParameterCache: MutableList = mutableListOf() + val copiedReturnType = originalReturnType.withReplacedConeType( + originalReturnType.coneTypeOrNull?.copyConeTypeOrSelf(originalTypeParameterCache) + ) + + // copy完了再resolve,这样里面包的type parameter就不会有问题了(如果有type parameter的话) + val resolvedReturnType = resolveReturnType(funData.transformer, copiedReturnType) + + val newFunTarget = FirFunctionTarget(null, isLambda = false) - val returnType = resolveReturnType(funData.transformer, original.returnTypeRef) + val p1 = buildProperty { + symbol = pSymbol + name = callableId.callableName + source = original.source + resolvePhase = original.resolvePhase + moduleData = original.moduleData + origin = pKey.origin + attributes = original.attributes.copy() + status = original.status.copy( + isSuspend = false, + isFun = false, + isInner = false, + modality = original.syntheticModifier, + isOverride = isOverride || isOverridable( + session, + callableId.callableName, + original, + owner, + isProperty = true + ), + ) - val p1 = buildProperty { - symbol = pSymbol - name = callableId.callableName - source = original.source - resolvePhase = original.resolvePhase + isVar = false + isLocal = false + // Copy return type + returnTypeRef = resolvedReturnType + deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider + containerSource = original.containerSource + dispatchReceiverType = original.dispatchReceiverType + contextReceivers.addAll(original.contextReceivers) + // annotations + annotations.addAll(propertyAnnotations) + typeParameters.addAll(original.typeParameters) + resolvePhase = FirResolvePhase.BODY_RESOLVE + backingField = null + bodyResolveState = FirPropertyBodyResolveState.NOTHING_RESOLVED + + getter = buildPropertyAccessor { + propertySymbol = pSymbol + val propertyAccessorSymbol = FirPropertyAccessorSymbol() + symbol = propertyAccessorSymbol + isGetter = true + resolvePhase = FirResolvePhase.BODY_RESOLVE moduleData = original.moduleData + + // annotations + annotations.addAll(functionAnnotations) + + returnTypeRef = resolvedReturnType origin = pKey.origin - attributes = original.attributes.copy() + status = original.status.copy( isSuspend = false, isFun = false, isInner = false, - // modality = if (original.status.isOverride) Modality.OPEN else original.status.modality, modality = original.syntheticModifier, - isOverride = isOverride || isOverridable( - session, - callableId.callableName, - original, - owner, - isProperty = true - ), + isOverride = false, // funData.isOverride, + // visibility = this@buildProperty.status ) - isVar = false - isLocal = false - returnTypeRef = returnType - deprecationsProvider = UnresolvedDeprecationProvider //original.deprecationsProvider - containerSource = original.containerSource - dispatchReceiverType = original.dispatchReceiverType - contextReceivers.addAll(original.contextReceivers) - // annotations - annotations.addAll(propertyAnnotations) + valueParameters.addAll(original.valueParameters) typeParameters.addAll(original.typeParameters) - resolvePhase = FirResolvePhase.BODY_RESOLVE - backingField = null - bodyResolveState = FirPropertyBodyResolveState.NOTHING_RESOLVED - - getter = buildPropertyAccessor { - propertySymbol = pSymbol - symbol = FirPropertyAccessorSymbol() - isGetter = true - resolvePhase = FirResolvePhase.BODY_RESOLVE - moduleData = original.moduleData - - // annotations - annotations.addAll(functionAnnotations) - - returnTypeRef = returnType - - origin = pKey.origin - - // attributes = original.attributes.copy() - status = original.status.copy( - isSuspend = false, - isFun = false, - isInner = false, - modality = original.syntheticModifier, - isOverride = false, // funData.isOverride, - // visibility = this@buildProperty.status - ) - returnTypeRef = original.returnTypeRef - // deprecationsProvider = original.deprecationsProvider - // containerSource = original.containerSource - // dispatchReceiverType = original.dispatchReceiverType - // contextReceivers.addAll(original.contextReceivers) - valueParameters.addAll(original.valueParameters) - // body = null - // contractDescription = original.contractDescription - typeParameters.addAll(original.typeParameters) - } - } + contextReceivers.addAll(original.contextReceivers) - propList.add(p1.symbol) + copyParameters(originalTypeParameterCache, false) - if (targetMarkerAnnotation != null) { - original.appendTargetMarker(uniqueFunHash) - } + val thisContextReceivers = this.contextReceivers + val thisValueParameters = this.valueParameters - // TODO 在原函数上附加的annotations + body = generateSyntheticFunctionBody( + original, + originalFunSymbol, + owner, + thisContextReceivers, + null, + propertyAccessorSymbol, + thisValueParameters, + funData.transformerFunctionSymbol, + newFunTarget, + funData.transformer + ) + }.also { getter -> + newFunTarget.bind(getter) + } } + + propList.add(p1.symbol) + +// if (targetMarkerAnnotation != null) { +// original.appendTargetMarker(uniqueFunHash) +// } + + // 在原函数上附加的annotations + original.includeAnnotations(includeToOriginal) + } return propList } + private fun checkSyntheticFunctionIsOverrideBasedOnSourceFunction( syntheticFunData: SyntheticFunData, func: FirNamedFunctionSymbol, @@ -881,7 +830,7 @@ class SuspendTransformFirTransformer( private fun createCache( classSymbol: FirClassSymbol<*>, declaredScope: FirClassDeclaredMemberScope? - ): Map>? { + ): Map>? { if (declaredScope == null) return null fun check(targetPlatform: TargetPlatform): Boolean { @@ -897,31 +846,22 @@ class SuspendTransformFirTransformer( } } - // TODO - // https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin/issues/75 - // 原始函数生成两个函数: - // 1. xxxBlocking 真正要生成的函数 - // 2. __suspendTransform__$funName_$index_$transFunName 用于提供给 IR 直接生成body的private桥接函数 - - // fun.name -> Counter - val funNameCounters = mutableMapOf() - - fun resolveFunNameCount(name: String): Int = funNameCounters.computeIfAbsent(name) { - AtomicInteger(0) - }.andIncrement - - // Key -> synthetic fun name or bridge fun name + // Key -> synthetic fun name // Value Map -> // Key: -> origin fun symbol // Values -> FunData - val map = ConcurrentHashMap>() + val map = ConcurrentHashMap>() +// val transformerFunctionSymbolMap = ConcurrentHashMap() + + val platformTransformers = suspendTransformConfiguration.transformers + .filter { (platform, _) -> check(platform) } declaredScope.processAllFunctions { func -> if (!func.isSuspend) return@processAllFunctions val functionName = func.name.asString() - suspendTransformConfiguration.transformers.asSequence() - .filter { (platform, _) -> check(platform) } + + platformTransformers .forEach { (_, transformerList) -> for (transformer in transformerList) { val markAnnotation = transformer.markAnnotation @@ -929,6 +869,8 @@ class SuspendTransformFirTransformer( val anno = firAnnotation(func, markAnnotation, classSymbol) ?: continue + val transformerFunctionSymbol = transformerFunctionSymbolMap[transformer] + ?: error("Cannot find transformer function symbol for transformer: $transformer") // 读不到注解的参数? // 必须使用 anno.getXxxArgument(Name(argument name)), @@ -936,78 +878,18 @@ class SuspendTransformFirTransformer( // println("RAW AnnoData: ${anno.argumentMapping.mapping}") val annoData = anno.toTransformAnnotationData(markAnnotation, functionName) - val funCount = resolveFunNameCount(functionName) - val syntheticFunNameString = annoData.functionName - val bridgeFunNameString = bridgeFunName(functionName, funCount, syntheticFunNameString) val syntheticFunName = Name.identifier(syntheticFunNameString) - val bridgeFunName = Name.identifier(bridgeFunNameString) - - val bridgeFunCallableId = func.callableId.replaceName(bridgeFunName) - - val bridgeFunSymbol = FirNamedFunctionSymbol(bridgeFunCallableId) - - // noinline suspend () -> T - val suspendLambdaValueParameter = buildValueParameter { - source = func.source - resolvePhase = FirResolvePhase.RAW_FIR - moduleData = func.moduleData - origin = FirDeclarationOrigin.Synthetic.FakeFunction - - returnTypeRef = buildResolvedTypeRef { - source = func.source - val funTypeRef = buildFunctionTypeRef { - source = func.source - isMarkedNullable = false - receiverTypeRef = null - isSuspend = true - returnTypeRef = func.resolvedReturnTypeRef - } - - delegatedTypeRef = funTypeRef - - coneType = session.typeResolver.resolveType( - funTypeRef, - ScopeClassDeclaration(emptyList(), emptyList()), - false, - false, - false, - null, - SupertypeSupplier.Default, - ).type - } - - backingField = null - defaultValue = null - val pname = Name.identifier("block") - name = pname - symbol = FirValueParameterSymbol(pname) - containingFunctionSymbol = bridgeFunSymbol - isVararg = false - isCrossinline = false - isNoinline = true - } - - val returnType = resolveReturnType(transformer, func.resolvedReturnTypeRef) - - val bridgeFunData = BridgeFunData( - bridgeFunName, - bridgeFunSymbol, - FirFunctionTarget(null, false), - suspendLambdaValueParameter, - returnType, - annoData, - transformer - ) - - map.computeIfAbsent(bridgeFunName) { name -> - ConcurrentHashMap() - }[func] = bridgeFunData map.computeIfAbsent(syntheticFunName) { ConcurrentHashMap() - }[func] = SyntheticFunData(syntheticFunName, bridgeFunData) + }[func] = SyntheticFunData( + syntheticFunName, + annoData, + transformer, + transformerFunctionSymbol + ) } } } @@ -1015,11 +897,6 @@ class SuspendTransformFirTransformer( return map } - private fun bridgeFunName(original: String, count: Int, syntheticFun: String): String { - // __suspendTransform__run_0_runBlocking - return "__suspendTransform__${original}_${count}_${syntheticFun}" - } - private fun FirAnnotation.toTransformAnnotationData( markAnnotation: MarkAnnotation, sourceFunctionName: String @@ -1093,9 +970,11 @@ class SuspendTransformFirTransformer( */ private fun copyAnnotations( original: FirSimpleFunction, syntheticFunData: SyntheticFunData, - ): Pair, List> { + ): CopyAnnotations { val transformer = syntheticFunData.transformer + val originalAnnotationClassIdMap = original.annotations.keysToMap { it.toAnnotationClassId(session) } + val (copyFunction, copyProperty, excludes, includes) = CopyAnnotationsData( transformer.copyAnnotationsToSyntheticFunction, transformer.copyAnnotationsToSyntheticProperty, @@ -1105,10 +984,10 @@ class SuspendTransformFirTransformer( val functionAnnotationList = buildList { if (copyFunction) { - val notCompileAnnotationsCopied = original.annotations.filterNot { - val annotationClassId = it.toAnnotationClassId(session) ?: return@filterNot true - annotationClassId == targetMarkerAnnotation || excludes.any { ex -> annotationClassId == ex } - } + val notCompileAnnotationsCopied = originalAnnotationClassIdMap.filterNot { (_, annotationClassId) -> + if (annotationClassId == null) return@filterNot true + excludes.any { ex -> annotationClassId == ex } + }.keys /* * Create a new annotation based the annotation from the original function. @@ -1150,10 +1029,10 @@ class SuspendTransformFirTransformer( val propertyAnnotationList = buildList { if (copyProperty) { - val notCompileAnnotationsCopied = original.annotations.filterNot { - val annotationClassId = it.toAnnotationClassId(session) ?: return@filterNot true + val notCompileAnnotationsCopied = originalAnnotationClassIdMap.filterNot { (_, annotationClassId) -> + if (annotationClassId == null) return@filterNot true excludes.any { ex -> annotationClassId == ex } - } + }.keys addAll(notCompileAnnotationsCopied) } @@ -1173,58 +1052,29 @@ class SuspendTransformFirTransformer( } } - return functionAnnotationList to propertyAnnotationList - } - - - private fun FirAnnotationArgumentMappingBuilder.includeGeneratedArguments(function: FirSimpleFunction) { - fun MutableList.addString(value: String) { - val expression = buildLiteralExpression( - source = null, - kind = ConstantValueKind.String, - value = value, - setType = false - ) + // original annotations - add(expression) - } + val infos = transformer.originFunctionIncludeAnnotations.map { it.toInfo() } - fun ConeKotlinType.typeString(): String { - return buildString { - append(classId?.asFqNameString()) - collectUpperBounds() - .takeIf { it.isNotEmpty() } - ?.also { upperBounds -> - upperBounds.joinTo(this, "&") { type -> - type.classId?.asFqNameString() ?: "?NULL?" - } - } - if (this@typeString is ConeClassLikeType && typeArguments.isNotEmpty()) { - typeArguments.joinTo(this, ", ", "<", ">") { argument -> - argument.type?.classId?.asFqNameString() ?: "?NULL?" + val includeToOriginals: List = infos + .mapNotNull { (classId, repeatable, _) -> + if (!repeatable) { + // 不能是已经存在的 + if (originalAnnotationClassIdMap.values.any { it == classId }) { + return@mapNotNull null } } - } - } - with(mapping) { - put(Name.identifier("by"), buildArrayLiteral { - argumentList = buildArgumentList { - with(arguments) { - addString(function.name.asString()) - function.valueParameters.forEach { vp -> - addString(vp.name.asString()) - vp.returnTypeRef.coneTypeOrNull?.also { coneType -> - addString(coneType.typeString()) - } - } - addString(function.returnTypeRef.coneTypeOrNull?.typeString() ?: "?") + buildAnnotation { + argumentMapping = buildAnnotationArgumentMapping() + annotationTypeRef = buildResolvedTypeRef { + coneType = classId.createConeType(session) } } - }) - } - } + } + return CopyAnnotations(functionAnnotationList, propertyAnnotationList, includeToOriginals) + } private fun isOverridable( session: FirSession, @@ -1348,6 +1198,11 @@ class SuspendTransformFirTransformer( original.toConeType() == target }?.copied + val copiedThis = findCopied(this) + if (copiedThis != null) { + return copiedThis.toConeType() + } + when (this) { is ConeDynamicType -> { //println("Dynamic type: $this") @@ -1357,28 +1212,30 @@ class SuspendTransformFirTransformer( //println("Flexible type: $this") } - // var typeArguments: Array = emptyArray() - // - // if (transformer.transformReturnTypeGeneric) { - // typeArguments = arrayOf(ConeKotlinTypeProjectionOut(original.returnTypeRef.coneType)) - // } - is ConeClassLikeType -> { if (typeArguments.isNotEmpty()) { - fun mapProjection(projection: ConeTypeProjection): ConeTypeProjection? { + val findCopiedDirectly = projection.type?.let { type -> findCopied(type) } + if (findCopiedDirectly != null) { + return findCopiedDirectly.toConeType() + } + return when (projection) { - // is ConeFlexibleType -> { - // } + // is ConeFlexibleType -> { } + + is ConeClassLikeType -> { + projection.copyWithTypeParameters(parameters) + } + is ConeCapturedType -> { - val lowerType = projection.lowerType?.let { lowerType -> - findCopied(lowerType) - }?.toConeType() +// val lowerType = projection.lowerType?.let { lowerType -> +// findCopied(lowerType) +// }?.toConeType() + + val lowerType = projection.lowerType?.copyWithTypeParameters(parameters) if (lowerType == null) { - projection.copy( - lowerType = lowerType - ) + projection.copy(lowerType = lowerType) } else { null } @@ -1392,16 +1249,18 @@ class SuspendTransformFirTransformer( // is ConeIntegerConstantOperatorType -> TODO() // is ConeIntegerLiteralConstantType -> TODO() is ConeIntersectionType -> { - val upperBoundForApproximation = - projection.upperBoundForApproximation - ?.let { findCopied(it) } - ?.toConeType() + val upperBoundForApproximation = projection.upperBoundForApproximation + ?.copyWithTypeParameters(parameters) +// val upperBoundForApproximation = +// projection.upperBoundForApproximation +// ?.let { findCopied(it) } +// ?.toConeType() var anyIntersectedTypes = false val intersectedTypes = projection.intersectedTypes.map { ktype -> - findCopied(ktype) - ?.toConeType() + findCopied(ktype)?.toConeType() +// ktype.copyWithTypeParameters(parameters) ?.also { anyIntersectedTypes = true } ?: ktype } @@ -1417,33 +1276,42 @@ class SuspendTransformFirTransformer( } // is ConeLookupTagBasedType -> TODO() // is ConeStubTypeForTypeVariableInSubtyping -> TODO() - // is ConeTypeVariableType -> { - // TODO() - // } + // is ConeTypeVariableType -> TODO() is ConeKotlinTypeConflictingProjection -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeKotlinTypeProjectionIn -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeKotlinTypeProjectionOut -> { - findCopied(projection.type) - ?.toConeType() +// findCopied(projection.type) +// ?.toConeType() +// ?.let { projection.copy(it) } + + projection.type.copyWithTypeParameters(parameters) ?.let { projection.copy(it) } } is ConeTypeParameterType -> { - findCopied(projection)?.toConeType() +// findCopied(projection)?.toConeType() + projection.copyWithTypeParameters(parameters) } - ConeStarProjection -> projection - // Other unknowns + ConeStarProjection -> ConeStarProjection + + // Other unknowns, e.g., ClassLike else -> null } } @@ -1466,17 +1334,18 @@ class SuspendTransformFirTransformer( } is ConeTypeParameterType -> { - return parameters.find { (original, _) -> - original.toConeType() == this - }?.copied?.toConeType() ?: this + return findCopied(this)?.toConeType() ?: this +// return parameters.find { (original, _) -> +// original.toConeType() == this +// }?.copied?.toConeType() ?: this } else -> { - + // ? } } - return this - // this.fullyExpandedClassId().createConeType() + + return null } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt index cc53c85..01f8e70 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformPluginKey.kt @@ -15,3 +15,8 @@ data class SuspendTransformPluginKey(val data: SuspendTransformUserDataFir) : data class SuspendTransformBridgeFunctionKey(val data: SuspendTransformBridgeFunDataFir) : SuspendTransformGeneratedDeclarationKey() + +/** + * The v3 logic for generating suspend bridge functions: generate body in FIR stage. + */ +object SuspendTransformK2V3Key : SuspendTransformGeneratedDeclarationKey() diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt index a9646d4..c03aa9d 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt @@ -3,6 +3,7 @@ package love.forte.plugin.suspendtrans.ir import love.forte.plugin.suspendtrans.* import love.forte.plugin.suspendtrans.fir.SuspendTransformBridgeFunctionKey import love.forte.plugin.suspendtrans.fir.SuspendTransformGeneratedDeclarationKey +import love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key import love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey import love.forte.plugin.suspendtrans.utils.* import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext @@ -81,9 +82,15 @@ class SuspendTransformTransformer( val userData = descriptor.getUserData(SuspendTransformUserDataKey) val generatedOriginFunction: IrFunction? = when { - pluginKey != null -> { + // K2 v3, 如果已经有body了,则不再需要生成,直接跳过。 + declaration.body != null -> return null + pluginKey != null -> { when (pluginKey) { + // K2 v3, 通常是已经完成body生成的,跳过(应该到不了这一步,因为 body != null 已经在上面被检测过了 + is SuspendTransformK2V3Key -> null + + // K2 v2 is SuspendTransformBridgeFunctionKey -> { val callableFunction = pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId()) @@ -321,13 +328,15 @@ class SuspendTransformTransformer( function: IrFunction, transformTargetFunctionCall: IrSimpleFunctionSymbol, ) { - // body: return $transform(block, scope?) - function.body = generateTransformBodyForFunctionLambda( - pluginContext, - function, - null, - transformTargetFunctionCall - ) + if (function.body == null) { + // body: return $transform(block, scope?) + function.body = generateTransformBodyForFunctionLambda( + pluginContext, + function, + null, + transformTargetFunctionCall + ) + } } } diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt index 8db1b49..193eea1 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/utils/FirUtils.kt @@ -1,71 +1,8 @@ package love.forte.plugin.suspendtrans.utils -import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.expressions.FirEmptyArgumentList -import org.jetbrains.kotlin.fir.expressions.builder.buildAnnotationCall -import org.jetbrains.kotlin.fir.moduleData -import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference -import org.jetbrains.kotlin.fir.resolve.defaultType -import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider -import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol -import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.types.builder.buildResolvedTypeRef -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.platform.isJs -import org.jetbrains.kotlin.platform.jvm.isJvm -import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull +import org.jetbrains.kotlin.fir.expressions.FirAnnotation -private val jsExportIgnore = ClassId.fromString("kotlin/js/JsExport.Ignore") -private val jvmSynthetic = ClassId.fromString("kotlin/jvm/JvmSynthetic") - -fun FirDeclaration.excludeFromJsExport(session: FirSession) { - if (!session.moduleData.platform.isJs()) { - return - } - val jsExportIgnore = session.symbolProvider.getClassLikeSymbolByClassId(jsExportIgnore) - val jsExportIgnoreAnnotation = jsExportIgnore as? FirRegularClassSymbol ?: return - val jsExportIgnoreConstructor = - jsExportIgnoreAnnotation.declarationSymbols.firstIsInstanceOrNull() ?: return - - val jsExportIgnoreAnnotationCall = buildAnnotationCall { - argumentList = FirEmptyArgumentList - annotationTypeRef = buildResolvedTypeRef { - coneType = jsExportIgnoreAnnotation.defaultType() - } - calleeReference = buildResolvedNamedReference { - name = jsExportIgnoreAnnotation.name - resolvedSymbol = jsExportIgnoreConstructor - } - - containingDeclarationSymbol = this@excludeFromJsExport.symbol - } - - replaceAnnotations(annotations + jsExportIgnoreAnnotationCall) -} - -fun FirDeclaration.jvmSynthetic(session: FirSession) { - if (!session.moduleData.platform.isJvm()) { - return - } - - val jvmSynthetic = session.symbolProvider.getClassLikeSymbolByClassId(jvmSynthetic) - val jvmExportIgnoreAnnotation = jvmSynthetic as? FirRegularClassSymbol ?: return - val jvmExportIgnoreConstructor = - jvmExportIgnoreAnnotation.declarationSymbols.firstIsInstanceOrNull() ?: return - - val jvmSyntheticAnnotationCall = buildAnnotationCall { - argumentList = FirEmptyArgumentList - annotationTypeRef = buildResolvedTypeRef { - coneType = jvmExportIgnoreAnnotation.defaultType() - } - calleeReference = buildResolvedNamedReference { - name = jvmExportIgnoreAnnotation.name - resolvedSymbol = jvmExportIgnoreConstructor - } - - containingDeclarationSymbol = this@jvmSynthetic.symbol - } - - replaceAnnotations(annotations + jvmSyntheticAnnotationCall) +fun FirDeclaration.includeAnnotations(includes: List) { + replaceAnnotations(annotations + includes) } diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index 505d025..d0d454a 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -44,6 +44,12 @@ public void testTypeAttr() { runTest("src/testData/codegen/typeAttr.kt"); } + @Test + @TestMetadata("typeAttrNested.kt") + public void testTypeAttrNested() { + runTest("src/testData/codegen/typeAttrNested.kt"); + } + @Test @TestMetadata("opt.kt") public void testOpt() { diff --git a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt index 8dfe997..8b63a10 100644 --- a/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt +++ b/compiler/suspend-transform-plugin/src/test/love/forte/plugin/suspendtrans/services/SuspendTransformerEnvironmentConfigurator.kt @@ -50,17 +50,33 @@ class SuspendTransformerEnvironmentConfigurator(testServices: TestServices) : En it ) } + + // register coroutines + getRuntimeJarFile("kotlinx.coroutines.CoroutineScope")?.let { + configuration.addJvmClasspathRoot( + it + ) + } } private fun getRuntimeJarFile(className: String): File? { try { - val clazz = Class.forName(className) - return PathUtil.getResourcePathForClass(clazz) - } catch (e: ClassNotFoundException) { + return getRuntimeJarFile(Class.forName(className)) + } catch (_: ClassNotFoundException) { System.err.println("Runtime jar '$className' not found!") // assert(false) { "Runtime jar '$className' not found!" } } return null } + private fun getRuntimeJarFile(clazz: Class<*>): File { +// try { + return PathUtil.getResourcePathForClass(clazz) +// } catch (e: ClassNotFoundException) { +// System.err.println("Runtime jar '$clazz' not found!") +//// assert(false) { "Runtime jar '$className' not found!" } +// } +// return null + } + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt index dd3bc1b..5b7f753 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.ir.txt @@ -18,7 +18,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.MyClass @@ -27,26 +27,28 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun errorReproductionAsync (amount: kotlin.Long): java.util.concurrent.CompletableFuture declared in .MyClass' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .MyClass.errorReproductionAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionAsync' CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionAsync' type=kotlin.Long origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit annotations: Api4J $this: VALUE_PARAMETER name: type:.MyClass VALUE_PARAMETER name:amount index:0 type:kotlin.Long BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun errorReproductionBlocking (amount: kotlin.Long): kotlin.Unit declared in .MyClass' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Unit origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionBlocking' type=.MyClass origin=null amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionBlocking' type=kotlin.Long origin=null @@ -54,7 +56,6 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=") JvmSynthetic $this: VALUE_PARAMETER name: type:.MyClass VALUE_PARAMETER name:amount index:0 type:kotlin.Long diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt index dee753c..c89ed2c 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/alias.fir.txt @@ -5,12 +5,22 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=)) public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { R|kotlin/io/println|(R|/amount|) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| { + ^errorReproductionAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Unit| { + ^ this@R|/MyClass|.R|/MyClass.errorReproduction|(R|/amount|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + ^errorReproductionBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Unit| { + ^ this@R|/MyClass|.R|/MyClass.errorReproduction|(R|/amount|) + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt index 94fc8b0..96829f4 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.ir.txt @@ -22,48 +22,49 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcFByb3BGb29udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:FINAL [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .PropFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:FINAL [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:FINAL [val] $this: VALUE_PARAMETER name: type:.PropFoo BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropImpl CONSTRUCTOR visibility:public <> () returnType:.PropImpl [primary] @@ -87,7 +88,6 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcFByb3BJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun prop (): kotlin.String declared in .IProp @@ -95,37 +95,37 @@ FILE fqName: fileName:/Main.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun prop (): kotlin.String declared in .PropImpl' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] annotations: Api4J overridden: public open prop: kotlin.String declared in .IProp - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] overridden: public open fun (): kotlin.String declared in .IProp $this: VALUE_PARAMETER name: type:.PropImpl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .PropImpl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] annotations: Api4J overridden: public open propAsync: java.util.concurrent.CompletableFuture declared in .IProp - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] overridden: public open fun (): java.util.concurrent.CompletableFuture declared in .IProp $this: VALUE_PARAMETER name: type:.PropImpl @@ -133,12 +133,14 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .PropImpl' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropImpl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null CLASS INTERFACE name:IProp modality:ABSTRACT visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IProp FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] @@ -158,42 +160,43 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = "", asProperty = true) JvmAsync(baseName = , suffix = , asProperty = true) - TargetMarker(value = "cHJvcElQcm9wbnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.IProp - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:prop visibility:public modality:OPEN [val] $this: VALUE_PARAMETER name: type:.IProp BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .IProp' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] annotations: Api4J - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:propAsync visibility:public modality:OPEN [val] $this: VALUE_PARAMETER name: type:.IProp BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .IProp' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IProp.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt index 8e4a88a..27e0fa3 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/asProperty.fir.txt @@ -4,25 +4,45 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BGb29udWxs)) public final suspend fun prop(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public final suspend fun prop(): R|kotlin/String| { ^prop String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropFoo|.R|/PropFoo.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropFoo|.R|/PropFoo.prop|() + } + , (this@R|/PropFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public abstract interface IProp : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcElQcm9wbnVsbA==)) public abstract suspend fun prop(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun prop(): R|kotlin/String| @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/IProp|.R|/IProp.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/IProp|.R|/IProp.prop|() + } + , (this@R|/IProp| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class PropImpl : R|IProp| { @@ -30,14 +50,24 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BJbXBsbnVsbA==)) public open override suspend fun prop(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun prop(): R|kotlin/String| { ^prop String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val prop: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropImpl|.R|/PropImpl.prop|() + } + ) + } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val propAsync: R|java/util/concurrent/CompletableFuture| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|java/util/concurrent/CompletableFuture| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/PropImpl|.R|/PropImpl.prop|() + } + , (this@R|/PropImpl| as? R|kotlinx/coroutines/CoroutineScope|)) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt index e81cdb2..275a65b 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.ir.txt @@ -18,7 +18,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicBar @@ -27,14 +27,16 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicBar.bar2Async' CALL 'public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicBar @@ -42,16 +44,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicBar.barAsync' CALL 'public final fun bar (): kotlin.String declared in .BasicBar' type=kotlin.String origin=null $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyQmFzaWNCYXJudWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar BLOCK_BODY @@ -60,7 +63,6 @@ FILE fqName: fileName:/Main.kt FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicBar VALUE_PARAMETER name:i index:0 type:kotlin.Int @@ -86,7 +88,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.BasicFoo @@ -94,16 +96,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .BasicFoo.fooAsync' CALL 'public final fun foo (): kotlin.String declared in .BasicFoo' type=kotlin.String origin=null $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "Zm9vQmFzaWNGb29udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.BasicFoo BLOCK_BODY @@ -144,7 +147,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.InterfaceBar @@ -153,14 +156,16 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .InterfaceBar.bar2Async' CALL 'public abstract fun bar2 (i: kotlin.Int): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.InterfaceBar @@ -168,25 +173,25 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .InterfaceBar.barAsync' CALL 'public abstract fun bar (): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFySW50ZXJmYWNlQmFybnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50") JvmSynthetic $this: VALUE_PARAMETER name: type:.InterfaceBar VALUE_PARAMETER name:i index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt index ca0b8f6..3dbb328 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/basic.fir.txt @@ -4,11 +4,16 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(Zm9vQmFzaWNGb29udWxs)) public final suspend fun foo(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun foo(): R|kotlin/String| { ^foo String(foo) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| { + ^fooAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicFoo|.R|/BasicFoo.foo|() + } + , (this@R|/BasicFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class BasicBar : R|kotlin/Any| { @@ -16,29 +21,49 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyQmFzaWNCYXJudWxs)) public final suspend fun bar(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun bar(): R|kotlin/String| { ^bar String(bar) } - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=)) public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { ^bar2 String(bar2) } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^bar2Async R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicBar|.R|/BasicBar.bar2|(R|/i|) + } + , (this@R|/BasicBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| { + ^barAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/BasicBar|.R|/BasicBar.bar|() + } + , (this@R|/BasicBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public abstract interface InterfaceBar : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFySW50ZXJmYWNlQmFybnVsbA==)) public abstract suspend fun bar(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun bar(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50)) public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| public abstract fun asyncBase(i: R|kotlin/Int|): R|ResultValue| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^bar2Async R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/InterfaceBar|.R|/InterfaceBar.bar2|(R|/i|) + } + , (this@R|/InterfaceBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| { + ^barAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/String| { + ^ this@R|/InterfaceBar|.R|/InterfaceBar.bar|() + } + , (this@R|/InterfaceBar| as? R|kotlinx/coroutines/CoroutineScope|)) + } } public final class ResultValue : R|kotlin/Any| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt index 2dae78c..3117171 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.ir.txt @@ -18,56 +18,55 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface1 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface1Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' CALL 'public open fun data3 (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface1 @@ -78,7 +77,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1 @@ -90,7 +88,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): kotlin.String declared in .FooInterface1 @@ -118,7 +115,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface2 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -127,16 +124,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface2Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -145,16 +142,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' CALL 'public open fun data3 (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String annotations: Api4J overridden: @@ -162,18 +159,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface2Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface2 @@ -184,7 +180,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2 @@ -196,7 +191,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): kotlin.String declared in .FooInterface2 @@ -227,7 +221,6 @@ FILE fqName: fileName:/Main.kt FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = true) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface3 @@ -235,26 +228,26 @@ FILE fqName: fileName:/Main.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface3Impl' CONST String type=kotlin.String value="" - PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN [val] annotations: Api4J overridden: public open dataBlocking: kotlin.String declared in .FooInterface3 - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String annotations: Api4J - correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN [val] overridden: public open fun (): kotlin.String declared in .FooInterface3 $this: VALUE_PARAMETER name: type:.FooInterface3Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' CALL 'public open fun data (): kotlin.String declared in .FooInterface3Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface3Impl declared in .FooInterface3Impl.' type=.FooInterface3Impl origin=null CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4] @@ -276,7 +269,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface4 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String annotations: Api4J overridden: @@ -285,16 +278,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface4Impl.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String annotations: Api4J overridden: @@ -302,18 +295,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface4Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' CALL 'public open fun data (): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==") JvmSynthetic overridden: public abstract fun data (): kotlin.String declared in .FooInterface4 @@ -324,7 +316,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50") JvmSynthetic overridden: public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4 @@ -435,46 +426,44 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4 VALUE_PARAMETER name:value index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' CALL 'public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.data2Blocking' type=.FooInterface4 origin=null value: GET_VAR 'value: kotlin.Int declared in .FooInterface4.data2Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.String origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' CALL 'public abstract fun data (): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.dataBlocking' type=.FooInterface4 origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRudWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4 FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4 VALUE_PARAMETER name:value index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt index 95b1784..c45965c 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverriden.fir.txt @@ -12,23 +12,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { ^data3 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ (this@R|/FooInterface1Impl|, this@R|/FooInterface1Impl.data3Blocking|).R|/FooInterface1Impl.data3|() + } + ) + } } public abstract interface FooInterface2 : R|kotlin/Any| { @@ -56,23 +71,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { ^data3 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ (this@R|/FooInterface2Impl|, this@R|/FooInterface2Impl.data3Blocking|).R|/FooInterface2Impl.data3|() + } + ) + } } public abstract interface FooInterface3 : R|kotlin/Any| { @@ -89,22 +119,37 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val dataBlocking: R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| { + ^ R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data|() + } + ) + } } public abstract interface FooInterface4 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRudWxs)) public abstract suspend fun data(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=)) public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data|() + } + ) + } } public final class FooInterface4Impl : R|FooInterface4| { @@ -112,16 +157,26 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|kotlin/String| { ^data String() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { ^data2 String() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/String| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt index 7b2e294..8df2699 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.ir.txt @@ -19,7 +19,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface1 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl annotations: Api4J TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false @@ -27,50 +27,49 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface1Impl.data2Blocking): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' CALL 'public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null : $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null value: GET_VAR 'value: A of .FooInterface1Impl.data2Blocking declared in .FooInterface1Impl.data2Blocking' type=A of .FooInterface1Impl.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface1Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface1 declared in .FooInterface1 @@ -81,7 +80,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB") JvmSynthetic overridden: public abstract fun data2 (value: A of .FooInterface1.data2): T of .FooInterface1 declared in .FooInterface1 @@ -94,7 +92,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface1 declared in .FooInterface1 @@ -123,56 +120,55 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface2 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' CALL 'public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null value: GET_VAR 'value: T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=T of .FooInterface2Impl origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface2Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface2 declared in .FooInterface2 @@ -183,7 +179,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU") JvmSynthetic overridden: public abstract fun data2 (value: T of .FooInterface2): T of .FooInterface2 declared in .FooInterface2 @@ -195,7 +190,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface2 declared in .FooInterface2 @@ -224,7 +218,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface3 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -234,17 +228,17 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3Impl.data2Blocking): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' CALL 'public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null : $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data2Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null value: GET_VAR 'value: A of .FooInterface3Impl.data2Blocking declared in .FooInterface3Impl.data2Blocking' type=A of .FooInterface3Impl.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -253,16 +247,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data3Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl annotations: Api4J overridden: @@ -270,18 +264,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.dataBlocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface3 declared in .FooInterface3 @@ -292,7 +285,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB") JvmSynthetic overridden: public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3 @@ -305,7 +297,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3 @@ -334,7 +325,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .FooInterface4 $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -343,16 +334,16 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' CALL 'public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null value: GET_VAR 'value: T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=T of .FooInterface4Impl origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -361,16 +352,16 @@ FILE fqName: fileName:/Main.kt $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' CALL 'public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data3Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4Impl.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl annotations: Api4J overridden: @@ -378,18 +369,17 @@ FILE fqName: fileName:/Main.kt $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4Impl origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' CALL 'public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==") JvmSynthetic overridden: public abstract fun data (): T of .FooInterface4 declared in .FooInterface4 @@ -400,7 +390,6 @@ FILE fqName: fileName:/Main.kt FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU") JvmSynthetic overridden: public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 @@ -412,7 +401,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=") JvmSynthetic overridden: public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4 @@ -516,7 +504,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 annotations: Api4J TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false @@ -524,56 +512,54 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2Blocking BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' CALL 'public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null : $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data2Blocking' type=.FooInterface3.FooInterface3> origin=null value: GET_VAR 'value: A of .FooInterface3.data2Blocking declared in .FooInterface3.data2Blocking' type=A of .FooInterface3.data2Blocking origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' CALL 'public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data3Blocking' type=.FooInterface3.FooInterface3> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface3 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' CALL 'public abstract fun data (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.dataBlocking' type=.FooInterface3.FooInterface3> origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=") JvmSynthetic TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> @@ -581,7 +567,6 @@ FILE fqName: fileName:/Main.kt FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> $receiver: VALUE_PARAMETER name: type:kotlin.Int @@ -601,69 +586,66 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' CALL 'public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data2Blocking' type=.FooInterface4.FooInterface4> origin=null value: GET_VAR 'value: T of .FooInterface4 declared in .FooInterface4.data2Blocking' type=T of .FooInterface4 origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> $receiver: VALUE_PARAMETER name: type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' CALL 'public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data3Blocking' type=.FooInterface4.FooInterface4> origin=null $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4.data3Blocking' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 annotations: Api4J $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .FooInterface4 origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' CALL 'public abstract fun data (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.dataBlocking' type=.FooInterface4.FooInterface4> origin=null FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) - TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> $receiver: VALUE_PARAMETER name: type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt index 50347f6..e01f208 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.fir.txt @@ -16,23 +16,38 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|A|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface1Impl|.R|/FooInterface1Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface1Impl|, this@R|/FooInterface1Impl.data3Blocking|).R|/FooInterface1Impl.data3|() + } + ) + } } public abstract interface FooInterface2 : R|kotlin/Any| { @@ -48,37 +63,67 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|T|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface2Impl|.R|/FooInterface2Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface2Impl|, this@R|/FooInterface2Impl.data3Blocking|).R|/FooInterface2Impl.data3|() + } + ) + } } public abstract interface FooInterface3 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs)) public abstract suspend fun data(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=)) public abstract suspend fun data2(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|A|): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun R|kotlin/Int|.data3(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3|.R|/FooInterface3.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3|.R|/FooInterface3.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface3|, this@R|/FooInterface3.data3Blocking|).R|/FooInterface3.data3|() + } + ) + } } public final class FooInterface3Impl : R|FooInterface3| { @@ -86,37 +131,67 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|A|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface3Impl|.R|/FooInterface3Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface3Impl|, this@R|/FooInterface3Impl.data3Blocking|).R|/FooInterface3Impl.data3|() + } + ) + } } public abstract interface FooInterface4 : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs)) public abstract suspend fun data(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=)) public abstract suspend fun data2(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun data2(value: R|T|): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun R|kotlin/Int|.data3(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4|.R|/FooInterface4.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface4|, this@R|/FooInterface4.data3Blocking|).R|/FooInterface4.data3|() + } + ) + } } public final class FooInterface4Impl : R|FooInterface4| { @@ -124,22 +199,37 @@ FILE: Main.kt super() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data(): R|T| { ^data R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun data2(value: R|T|): R|T| { ^data2 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|kotlin/jvm/JvmSynthetic|() public open override suspend fun R|kotlin/Int|.data3(): R|T| { ^data3 R|kotlin/TODO|() } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| { + ^data2Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data2|(R|/value|) + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| { + ^dataBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/FooInterface4Impl|.R|/FooInterface4Impl.data|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| { + ^data3Blocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ (this@R|/FooInterface4Impl|, this@R|/FooInterface4Impl.data3Blocking|).R|/FooInterface4Impl.data3|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt index 9156a3a..4503f49 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.ir.txt @@ -70,7 +70,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture annotations: Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) Api4J @@ -79,25 +79,27 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public final fun runAsync (): java.util.concurrent.CompletableFuture declared in .OptInTest' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .OptInTest.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runAsync' CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null $this: GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int annotations: Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) Api4J $this: VALUE_PARAMETER name: type:.OptInTest BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun runBlocking (): kotlin.Int declared in .OptInTest' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null $this: GET_VAR ': .OptInTest declared in .OptInTest.runBlocking' type=.OptInTest origin=null FUN name:run visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] @@ -106,7 +108,6 @@ FILE fqName: fileName:/Main.kt Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuT3B0SW5UZXN0bnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.OptInTest BLOCK_BODY diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt index 5a12831..c7b9695 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/opt.fir.txt @@ -23,12 +23,22 @@ FILE: Main.kt ^run0 Int(1) } - @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuT3B0SW5UZXN0bnVsbA==)) public final suspend fun run(): R|kotlin/Int| { + @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public final suspend fun run(): R|kotlin/Int| { ^run this@R|/OptInTest|.R|/OptInTest.run0|() } - @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/OptInTest|.R|/OptInTest.run|() + } + , (this@R|/OptInTest| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/OptInTest|.R|/OptInTest.run|() + } + ) + } } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt index dcd2dec..91e889a 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.ir.txt @@ -134,7 +134,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in .IFoo $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo @@ -142,31 +142,32 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runAsync' CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=.Bar origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:.Bar [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuRm9vbnVsbA==") JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo, n:kotlin.Int) returnType:.Bar [suspend] @@ -198,7 +199,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.IFoo @@ -207,32 +208,33 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runAsync' CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar annotations: Api4J $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=.Bar origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] annotations: - TargetMarker(value = "cnVuSUZvb251bGxrb3RsaW4vSW50") JvmSynthetic $this: VALUE_PARAMETER name: type:.IFoo VALUE_PARAMETER name:n index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt index 16a577c..90a83b0 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/override.fir.txt @@ -1,14 +1,24 @@ FILE: Main.kt @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract interface IFoo : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuSUZvb251bGxrb3RsaW4vSW50)) public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| + @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|Bar| { + ^ this@R|/IFoo|.R|/IFoo.run|(R|/n|) + } + , (this@R|/IFoo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|Bar| { + ^ this@R|/IFoo|.R|/IFoo.run|(R|/n|) + } + ) + } } public abstract interface Foo : R|IFoo| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vbnVsbA==)) public abstract suspend fun run(): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(): R|Bar| public open suspend fun run(name: R|kotlin/String|): R|Tar| { ^run R|/Tar.Tar|() @@ -16,9 +26,19 @@ FILE: Main.kt public abstract override suspend fun run(n: R|kotlin/Int|): R|Bar| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|Bar| { + ^ this@R|/Foo|.R|/Foo.run|() + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|Bar| { + ^ this@R|/Foo|.R|/Foo.run|() + } + ) + } } public final class FooImpl : R|Foo| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt index b9e8fdf..b97041d 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.ir.txt @@ -136,7 +136,7 @@ FILE fqName: fileName:/Main.kt overridden: public open fun toString (): kotlin.String declared in kotlin.Any $this: VALUE_PARAMETER name: type:kotlin.Any - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture annotations: Api4J TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false @@ -146,15 +146,17 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.run> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.run [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.run declared in .Foo.runAsync' CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null : $this: GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null api: GET_VAR 'api: .Api.Foo.runAsync> declared in .Foo.runAsync' type=.Api.Foo.runAsync> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking annotations: Api4J TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false @@ -162,17 +164,17 @@ FILE fqName: fileName:/Main.kt VALUE_PARAMETER name:api index:0 type:.Api.Foo.runBlocking> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=R of .Foo.run origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.runBlocking> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.runBlocking [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.run> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.run [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.runBlocking declared in .Foo.runBlocking' + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.run declared in .Foo.runBlocking' CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null : $this: GET_VAR ': .Foo.Foo> declared in .Foo.runBlocking' type=.Foo.Foo> origin=null api: GET_VAR 'api: .Api.Foo.runBlocking> declared in .Foo.runBlocking' type=.Api.Foo.runBlocking> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo.Foo> @@ -180,31 +182,32 @@ FILE fqName: fileName:/Main.kt RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null : - block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueAsync' CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo annotations: Api4J $this: VALUE_PARAMETER name: type:.Foo.Foo> BLOCK_BODY RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' - CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of .Foo origin=null : block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null FUN name:run visibility:public modality:ABSTRACT ($this:.Foo.Foo>, api:.Api.Foo.run>) returnType:R of .Foo.run [suspend] annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "cnVuRm9vPFQ+bnVsbEFwaTxSPg==") JvmSynthetic TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false $this: VALUE_PARAMETER name: type:.Foo.Foo> @@ -213,6 +216,5 @@ FILE fqName: fileName:/Main.kt annotations: JvmBlocking(baseName = , suffix = , asProperty = ) JvmAsync(baseName = , suffix = , asProperty = ) - TargetMarker(value = "dmFsdWVGb288VD5udWxs") JvmSynthetic $this: VALUE_PARAMETER name: type:.Foo.Foo> diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt index cc5bfb9..7ace09f 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttr.fir.txt @@ -18,17 +18,37 @@ FILE: Main.kt } public abstract interface Foo : R|kotlin/Any| { - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(dmFsdWVGb288VD5udWxs)) public abstract suspend fun value(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun value(): R|T| - @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vPFQ+bnVsbEFwaTxSPg==)) public abstract suspend fun run(api: R|Api|): R|R| + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun run(api: R|Api|): R|R| - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| { + ^valueAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|T| { + ^ this@R|/Foo|.R|/Foo.value|() + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| { + ^valueBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|T| { + ^ this@R|/Foo|.R|/Foo.value|() + } + ) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| { + ^runAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|R| { + ^ this@R|/Foo|.R|/Foo.run|(R|/api|) + } + , (this@R|/Foo| as? R|kotlinx/coroutines/CoroutineScope|)) + } - @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| { + ^runBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|R| { + ^ this@R|/Foo|.R|/Foo.run|(R|/api|) + } + ) + } } public final class FooImpl : R|Foo| { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt new file mode 100644 index 0000000..437a7ce --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.asm.txt @@ -0,0 +1,35 @@ +public abstract interface Api : java/lang/Object { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) +} + +public final class ApiExecutable$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture executeAsync(ApiExecutable $this, Api api) +} + +final class ApiExecutable$executeAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final ApiExecutable this$0 + + void (ApiExecutable $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface ApiExecutable : java/lang/Object { + public abstract java.lang.Object execute(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture executeAsync(Api p0) +} + +public abstract interface ApiResult : java/lang/Object { + +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt new file mode 100644 index 0000000..e4c911c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.ir.txt @@ -0,0 +1,77 @@ +FILE fqName: fileName:/Main.kt + CLASS INTERFACE name:Api modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Api.Api>) returnType:T of .Api [suspend] + $this: VALUE_PARAMETER name: type:.Api.Api> + CLASS INTERFACE name:ApiExecutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiExecutable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:executeAsync visibility:public modality:OPEN ($this:.ApiExecutable, api:.Api.ApiExecutable.executeAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.executeAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun executeAsync (api: .Api.ApiExecutable.executeAsync>): java.util.concurrent.CompletableFuture declared in .ApiExecutable' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.ApiResult<.Api.ApiExecutable.execute>>> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable.executeAsync' + CALL 'public abstract fun execute (api: .Api.ApiExecutable.execute>): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable' type=.ApiResult<.Api.ApiExecutable.execute>> origin=null + : + $this: GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + api: GET_VAR 'api: .Api.ApiExecutable.executeAsync> declared in .ApiExecutable.executeAsync' type=.Api.ApiExecutable.executeAsync> origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + FUN name:execute visibility:public modality:ABSTRACT ($this:.ApiExecutable, api:.Api.ApiExecutable.execute>) returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.execute> + CLASS INTERFACE name:ApiResult modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiResult.ApiResult> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt new file mode 100644 index 0000000..4f7116b --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.fir.txt @@ -0,0 +1,18 @@ +FILE: Main.kt + public abstract interface Api : R|kotlin/Any| { + public abstract suspend fun run(): R|T| + + } + public abstract interface ApiResult : R|kotlin/Any| { + } + public abstract interface ApiExecutable : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public abstract suspend fun execute(api: R|Api|): R|ApiResult>| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun executeAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture>>| { + ^executeAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|ApiResult>| { + ^ this@R|/ApiExecutable|.R|/ApiExecutable.execute|(R|/api|) + } + , (this@R|/ApiExecutable| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt new file mode 100644 index 0000000..39afb79 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/typeAttrNested.kt @@ -0,0 +1,17 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +interface Api { + suspend fun run(): T +} + +interface ApiResult + +interface ApiExecutable { + @JvmAsync + suspend fun execute(api: Api): ApiResult> +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt new file mode 100644 index 0000000..6035411 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.asm.txt @@ -0,0 +1,47 @@ +final class MyClass$deleteAllAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$deleteAllBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract class MyClass : java/lang/Object { + public void () + + public java.lang.Object deleteAll(int option, kotlin.coroutines.Continuation $completion) + + static java.lang.Object deleteAll$suspendImpl(MyClass $this, int option, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture deleteAllAsync(int option) + + public int deleteAllBlocking(int option) +} diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt new file mode 100644 index 0000000..029b1a9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:deleteAllAsync visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllAsync (option: kotlin.Int): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllAsync' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllAsync' type=kotlin.Int origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformK2V3Key] name:deleteAllBlocking visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllBlocking (option: kotlin.Int): kotlin.Int declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllBlocking' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllBlocking' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllBlocking' type=kotlin.Int origin=null + FUN name:deleteAll visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + JvmSynthetic + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt new file mode 100644 index 0000000..c2ab915 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/varargParam.fir.txt @@ -0,0 +1,25 @@ +FILE: Main.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|kotlin/jvm/JvmSynthetic|() public open suspend fun deleteAll(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAll Int(1) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllAsync(option: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^deleteAllAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllBlocking(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAllBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + ) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt new file mode 100644 index 0000000..951b4c3 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.asm.txt @@ -0,0 +1,49 @@ +public final class MainKt : java/lang/Object { + +} + +final class MyClass$errorReproductionAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final long $amount + + int label + + final MyClass this$0 + + void (MyClass $receiver, long $amount, kotlin.coroutines.Continuation p2) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$errorReproductionBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final long $amount + + int label + + final MyClass this$0 + + void (MyClass $receiver, long $amount, kotlin.coroutines.Continuation p2) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class MyClass : java/lang/Object { + public void () + + public final java.lang.Object errorReproduction(long amount, kotlin.coroutines.Continuation p1) + + public final java.util.concurrent.CompletableFuture errorReproductionAsync(long amount) + + public final void errorReproductionBlocking(long amount) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt new file mode 100644 index 0000000..dd3bc1b --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionAsync visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun errorReproductionAsync (amount: kotlin.Long): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .MyClass.errorReproductionAsync' + CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionAsync' type=.MyClass origin=null + amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionAsync' type=kotlin.Long origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:errorReproductionBlocking visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun errorReproductionBlocking (amount: kotlin.Long): kotlin.Unit declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Unit [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Unit declared in .MyClass.errorReproductionBlocking' + CALL 'public final fun errorReproduction (amount: kotlin.Long): kotlin.Unit declared in .MyClass' type=kotlin.Unit origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.errorReproductionBlocking' type=.MyClass origin=null + amount: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproductionBlocking' type=kotlin.Long origin=null + FUN name:errorReproduction visibility:public modality:FINAL <> ($this:.MyClass, amount:kotlin.Long) returnType:kotlin.Unit [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:amount index:0 type:kotlin.Long + BLOCK_BODY + CALL 'public final fun println (message: kotlin.Long): kotlin.Unit declared in kotlin.io' type=kotlin.Unit origin=null + message: GET_VAR 'amount: kotlin.Long declared in .MyClass.errorReproduction' type=kotlin.Long origin=null + TYPEALIAS name:MoneyValue visibility:public expandedType:kotlin.Long diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt new file mode 100644 index 0000000..dee753c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.fir.txt @@ -0,0 +1,16 @@ +FILE: Main.kt + public final typealias MoneyValue = R|kotlin/Long| + public final class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXJyb3JSZXByb2R1Y3Rpb25NeUNsYXNzbnVsbHtNb25leVZhbHVlPX0ga290bGluL0xvbmc=)) public final suspend fun errorReproduction(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| { + R|kotlin/io/println|(R|/amount|) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionAsync(amount: R|{MoneyValue=} kotlin/Long|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun errorReproductionBlocking(amount: R|{MoneyValue=} kotlin/Long|): R|kotlin/Unit| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt new file mode 100644 index 0000000..ed0adc2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/alias.kt @@ -0,0 +1,16 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +typealias MoneyValue = Long + +class MyClass { + @JvmBlocking + @JvmAsync + suspend fun errorReproduction(amount: MoneyValue) { println(amount) } +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt new file mode 100644 index 0000000..f3395d3 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.asm.txt @@ -0,0 +1,141 @@ +public final class IProp$DefaultImpls : java/lang/Object { + public static java.lang.String getProp(IProp $this) + + public static void getProp$annotations() + + public static java.util.concurrent.CompletableFuture getPropAsync(IProp $this) + + public static void getPropAsync$annotations() +} + +final class IProp$prop$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final IProp this$0 + + void (IProp $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class IProp$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final IProp this$0 + + void (IProp $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface IProp : java/lang/Object { + public abstract java.lang.String getProp() + + public abstract java.util.concurrent.CompletableFuture getPropAsync() + + public abstract java.lang.Object prop(kotlin.coroutines.Continuation p0) +} + +final class PropFoo$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropFoo$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropFoo this$0 + + void (PropFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropFoo : java/lang/Object { + public void () + + public final java.lang.String getProp() + + public static void getProp$annotations() + + public final java.util.concurrent.CompletableFuture getPropAsync() + + public static void getPropAsync$annotations() + + public final java.lang.Object prop(kotlin.coroutines.Continuation $completion) +} + +final class PropImpl$prop$2 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class PropImpl$propAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final PropImpl this$0 + + void (PropImpl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class PropImpl : java/lang/Object, IProp { + public void () + + public java.lang.String getProp() + + public static void getProp$annotations() + + public java.util.concurrent.CompletableFuture getPropAsync() + + public static void getPropAsync$annotations() + + public java.lang.Object prop(kotlin.coroutines.Continuation $completion) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt new file mode 100644 index 0000000..94fc8b0 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.ir.txt @@ -0,0 +1,199 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropFoo + CONSTRUCTOR visibility:public <> () returnType:.PropFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcFByb3BGb29udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun prop (): kotlin.String declared in .PropFoo' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in .PropFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:FINAL <> ($this:.PropFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.PropFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropFoo.' + CALL 'public final fun prop (): kotlin.String declared in .PropFoo' type=kotlin.String origin=null + $this: GET_VAR ': .PropFoo declared in .PropFoo.' type=.PropFoo origin=null + CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.PropImpl + CONSTRUCTOR visibility:public <> () returnType:.PropImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:PropImpl modality:FINAL visibility:public superTypes:[.IProp]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcFByb3BJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun prop (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun prop (): kotlin.String declared in .PropImpl' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open prop: kotlin.String declared in .IProp + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .PropImpl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open propAsync: java.util.concurrent.CompletableFuture declared in .IProp + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.PropImpl) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + overridden: + public open fun (): java.util.concurrent.CompletableFuture declared in .IProp + $this: VALUE_PARAMETER name: type:.PropImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .PropImpl' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .PropImpl.' + CALL 'public open fun prop (): kotlin.String declared in .PropImpl' type=kotlin.String origin=null + $this: GET_VAR ': .PropImpl declared in .PropImpl.' type=.PropImpl origin=null + CLASS INTERFACE name:IProp modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IProp + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:prop visibility:public modality:ABSTRACT <> ($this:.IProp) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = "", asProperty = true) + JvmAsync(baseName = , suffix = , asProperty = true) + TargetMarker(value = "cHJvcElQcm9wbnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IProp + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:prop visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .IProp' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + annotations: + Api4J + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.IProp) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:propAsync visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.IProp + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): java.util.concurrent.CompletableFuture declared in .IProp' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IProp.' + CALL 'public abstract fun prop (): kotlin.String declared in .IProp' type=kotlin.String origin=null + $this: GET_VAR ': .IProp declared in .IProp.' type=.IProp origin=null diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt new file mode 100644 index 0000000..8e4a88a --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.fir.txt @@ -0,0 +1,43 @@ +FILE: Main.kt + public final class PropFoo : R|kotlin/Any| { + public constructor(): R|PropFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BGb29udWxs)) public final suspend fun prop(): R|kotlin/String| { + ^prop String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public abstract interface IProp : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcElQcm9wbnVsbA==)) public abstract suspend fun prop(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public final class PropImpl : R|IProp| { + public constructor(): R|PropImpl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true), suffix = String()) @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cHJvcFByb3BJbXBsbnVsbA==)) public open override suspend fun prop(): R|kotlin/String| { + ^prop String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val prop: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val propAsync: R|java/util/concurrent/CompletableFuture| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt new file mode 100644 index 0000000..76013dc --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/asProperty.kt @@ -0,0 +1,27 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +class PropFoo { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + suspend fun prop(): String = "" +} + + +interface IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + suspend fun prop(): String +} + +class PropImpl : IProp { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true, suffix = "") + @love.forte.plugin.suspendtrans.annotation.JvmAsync(asProperty = true) + override suspend fun prop(): String = "" +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt new file mode 100644 index 0000000..ff786c2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.asm.txt @@ -0,0 +1,125 @@ +final class BasicBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final BasicBar this$0 + + void (BasicBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class BasicBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicBar this$0 + + void (BasicBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicBar : java/lang/Object { + public void () + + public final java.lang.Object bar(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object bar2(int i, kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture bar2Async(int i) + + public final java.util.concurrent.CompletableFuture barAsync() +} + +final class BasicFoo$fooAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final BasicFoo this$0 + + void (BasicFoo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class BasicFoo : java/lang/Object { + public void () + + public final java.lang.Object foo(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture fooAsync() +} + +public final class InterfaceBar$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture bar2Async(InterfaceBar $this, int i) + + public static java.util.concurrent.CompletableFuture barAsync(InterfaceBar $this) +} + +final class InterfaceBar$bar2Async$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $i + + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, int $i, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class InterfaceBar$barAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final InterfaceBar this$0 + + void (InterfaceBar $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface InterfaceBar : java/lang/Object { + public abstract ResultValue asyncBase(int p0) + + public abstract java.lang.Object bar(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object bar2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture bar2Async(int p0) + + public abstract java.util.concurrent.CompletableFuture barAsync() +} + +public final class ResultValue : java/lang/Object { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt new file mode 100644 index 0000000..e81cdb2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.ir.txt @@ -0,0 +1,192 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicBar + CONSTRUCTOR visibility:public <> () returnType:.BasicBar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicBar modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.bar2Async' + CALL 'public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' type=kotlin.String origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.bar2Async' type=.BasicBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .BasicBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:FINAL <> ($this:.BasicBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun barAsync (): java.util.concurrent.CompletableFuture declared in .BasicBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicBar.barAsync' + CALL 'public final fun bar (): kotlin.String declared in .BasicBar' type=kotlin.String origin=null + $this: GET_VAR ': .BasicBar declared in .BasicBar.barAsync' type=.BasicBar origin=null + FUN name:bar visibility:public modality:FINAL <> ($this:.BasicBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyQmFzaWNCYXJudWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar (): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar" + FUN name:bar2 visibility:public modality:FINAL <> ($this:.BasicBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar2 (i: kotlin.Int): kotlin.String declared in .BasicBar' + CONST String type=kotlin.String value="bar2" + CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.BasicFoo + CONSTRUCTOR visibility:public <> () returnType:.BasicFoo [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:BasicFoo modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:fooAsync visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun fooAsync (): java.util.concurrent.CompletableFuture declared in .BasicFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .BasicFoo.fooAsync' + CALL 'public final fun foo (): kotlin.String declared in .BasicFoo' type=kotlin.String origin=null + $this: GET_VAR ': .BasicFoo declared in .BasicFoo.fooAsync' type=.BasicFoo origin=null + FUN name:foo visibility:public modality:FINAL <> ($this:.BasicFoo) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "Zm9vQmFzaWNGb29udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.BasicFoo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in .BasicFoo' + CONST String type=kotlin.String value="foo" + CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ResultValue.ResultValue> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.ResultValue.ResultValue> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ResultValue modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:InterfaceBar modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.InterfaceBar + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:bar2Async visibility:public modality:OPEN <> ($this:.InterfaceBar, i:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun bar2Async (i: kotlin.Int): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.bar2Async' + CALL 'public abstract fun bar2 (i: kotlin.Int): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.bar2Async' type=.InterfaceBar origin=null + i: GET_VAR 'i: kotlin.Int declared in .InterfaceBar.bar2Async' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:barAsync visibility:public modality:OPEN <> ($this:.InterfaceBar) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.InterfaceBar + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun barAsync (): java.util.concurrent.CompletableFuture declared in .InterfaceBar' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .InterfaceBar.barAsync' + CALL 'public abstract fun bar (): kotlin.String declared in .InterfaceBar' type=kotlin.String origin=null + $this: GET_VAR ': .InterfaceBar declared in .InterfaceBar.barAsync' type=.InterfaceBar origin=null + FUN name:asyncBase visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:.ResultValue + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int + FUN name:bar visibility:public modality:ABSTRACT <> ($this:.InterfaceBar) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFySW50ZXJmYWNlQmFybnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + FUN name:bar2 visibility:public modality:ABSTRACT <> ($this:.InterfaceBar, i:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.InterfaceBar + VALUE_PARAMETER name:i index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt new file mode 100644 index 0000000..ca0b8f6 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.fir.txt @@ -0,0 +1,49 @@ +FILE: Main.kt + public final class BasicFoo : R|kotlin/Any| { + public constructor(): R|BasicFoo| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(Zm9vQmFzaWNGb29udWxs)) public final suspend fun foo(): R|kotlin/String| { + ^foo String(foo) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun fooAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class BasicBar : R|kotlin/Any| { + public constructor(): R|BasicBar| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyQmFzaWNCYXJudWxs)) public final suspend fun bar(): R|kotlin/String| { + ^bar String(bar) + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkJhc2ljQmFybnVsbGtvdGxpbi9JbnQ=)) public final suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| { + ^bar2 String(bar2) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public abstract interface InterfaceBar : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFySW50ZXJmYWNlQmFybnVsbA==)) public abstract suspend fun bar(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(YmFyMkludGVyZmFjZUJhcm51bGxrb3RsaW4vSW50)) public abstract suspend fun bar2(i: R|kotlin/Int|): R|kotlin/String| + + public abstract fun asyncBase(i: R|kotlin/Int|): R|ResultValue| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun bar2Async(i: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun barAsync(): R|java/util/concurrent/CompletableFuture| + + } + public final class ResultValue : R|kotlin/Any| { + public constructor(): R|ResultValue| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt new file mode 100644 index 0000000..8e72785 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/basic.kt @@ -0,0 +1,30 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +class BasicFoo { + @JvmAsync + suspend fun foo(): String = "foo" +} + +class BasicBar { + @JvmAsync + suspend fun bar(): String = "bar" + @JvmAsync + suspend fun bar2(i: Int): String = "bar2" +} + +interface InterfaceBar { + @JvmAsync + suspend fun bar(): String + @JvmAsync + suspend fun bar2(i: Int): String + + fun asyncBase(i: Int): ResultValue +} + +class ResultValue diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt new file mode 100644 index 0000000..b161c51 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.asm.txt @@ -0,0 +1,297 @@ +public abstract interface FooInterface1 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface1Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface1Impl : java/lang/Object, FooInterface1 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public java.lang.String data3Blocking(int $this$data3Blocking) + + public java.lang.String dataBlocking() +} + +public final class FooInterface2$DefaultImpls : java/lang/Object { + public static java.lang.String data2Blocking(FooInterface2 $this, int value) + + public static java.lang.String data3Blocking(FooInterface2 $this, int $receiver) + + public static java.lang.String dataBlocking(FooInterface2 $this) +} + +public abstract interface FooInterface2 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data2Blocking(int p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data3Blocking(int p0) + + public abstract java.lang.String dataBlocking() +} + +final class FooInterface2Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface2Impl : java/lang/Object, FooInterface2 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public java.lang.String data3Blocking(int $this$data3Blocking) + + public java.lang.String dataBlocking() +} + +public final class FooInterface3$DefaultImpls : java/lang/Object { + public static java.lang.String getDataBlocking(FooInterface3 $this) +} + +public abstract interface FooInterface3 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.String getDataBlocking() +} + +final class FooInterface3Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface3Impl : java/lang/Object, FooInterface3 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.String getDataBlocking() + + public static void getDataBlocking$annotations() +} + +public final class FooInterface4$DefaultImpls : java/lang/Object { + public static java.lang.String data2Blocking(FooInterface4 $this, int value) + + public static java.lang.String dataBlocking(FooInterface4 $this) +} + +final class FooInterface4$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface4 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.String data2Blocking(int p0) + + public abstract java.lang.String dataBlocking() +} + +final class FooInterface4Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $value + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, int $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface4Impl : java/lang/Object, FooInterface4 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(int value, kotlin.coroutines.Continuation $completion) + + public java.lang.String data2Blocking(int value) + + public java.lang.String dataBlocking() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt new file mode 100644 index 0000000..2dae78c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.ir.txt @@ -0,0 +1,480 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface1Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface1Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.data3Blocking' + CALL 'public open fun data3 (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface1Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface1Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): kotlin.String declared in .FooInterface1Impl' + CONST String type=kotlin.String value="" + CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface2Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface2Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data3Blocking (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.data3Blocking' + CALL 'public open fun data3 (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun dataBlocking (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface2Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface2Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): kotlin.String declared in .FooInterface2Impl' + CONST String type=kotlin.String value="" + CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface3Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = true) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface3Impl' + CONST String type=kotlin.String value="" + PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + annotations: + Api4J + overridden: + public open dataBlocking: kotlin.String declared in .FooInterface3 + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name: visibility:public modality:OPEN <> ($this:.FooInterface3Impl) returnType:kotlin.String + annotations: + Api4J + correspondingProperty: PROPERTY GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN [val] + overridden: + public open fun (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface3Impl.' + CALL 'public open fun data (): kotlin.String declared in .FooInterface3Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface3Impl declared in .FooInterface3Impl.' type=.FooInterface3Impl origin=null + CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4Impl + CONSTRUCTOR visibility:public <> () returnType:.FooInterface4Impl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.data2Blocking' + CALL 'public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface4Impl.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String + annotations: + Api4J + overridden: + public open fun dataBlocking (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4Impl.dataBlocking' + CALL 'public open fun data (): kotlin.String declared in .FooInterface4Impl' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): kotlin.String declared in .FooInterface4Impl' + CONST String type=kotlin.String value="" + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50") + JvmSynthetic + overridden: + public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4Impl' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface1) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface1, value:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface1, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface2) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface2, value:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + FUN name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2, value:kotlin.Int) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface2, $receiver:kotlin.Int) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + FUN name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2, $receiver:kotlin.Int) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + FUN name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2) returnType:kotlin.String + $this: VALUE_PARAMETER name: type:.FooInterface2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface2' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface3 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3) returnType:kotlin.String [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface3 + PROPERTY name:dataBlocking visibility:public modality:OPEN [val] + FUN name: visibility:public modality:OPEN <> ($this:.FooInterface3) returnType:kotlin.String + correspondingProperty: PROPERTY name:dataBlocking visibility:public modality:OPEN [val] + $this: VALUE_PARAMETER name: type:.FooInterface3 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): kotlin.String declared in .FooInterface3' + CONST String type=kotlin.String value="" + CLASS INTERFACE name:FooInterface4 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4 + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4 + VALUE_PARAMETER name:value index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: kotlin.Int): kotlin.String declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.data2Blocking' + CALL 'public abstract fun data2 (value: kotlin.Int): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.data2Blocking' type=.FooInterface4 origin=null + value: GET_VAR 'value: kotlin.Int declared in .FooInterface4.data2Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4) returnType:kotlin.String + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): kotlin.String declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.String [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.String declared in .FooInterface4.dataBlocking' + CALL 'public abstract fun data (): kotlin.String declared in .FooInterface4' type=kotlin.String origin=null + $this: GET_VAR ': .FooInterface4 declared in .FooInterface4.dataBlocking' type=.FooInterface4 origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRudWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4 + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4, value:kotlin.Int) returnType:kotlin.String [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4 + VALUE_PARAMETER name:value index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt new file mode 100644 index 0000000..95b1784 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.fir.txt @@ -0,0 +1,127 @@ +FILE: Main.kt + public abstract interface FooInterface1 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + public abstract suspend fun R|kotlin/Int|.data3(): R|kotlin/String| + + } + public final class FooInterface1Impl : R|FooInterface1| { + public constructor(): R|FooInterface1Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + ^data3 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + + } + public abstract interface FooInterface2 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public open fun dataBlocking(): R|kotlin/String| { + ^dataBlocking String() + } + + public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| { + ^data2Blocking String() + } + + public abstract suspend fun R|kotlin/Int|.data3(): R|kotlin/String| + + public open fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| { + ^data3Blocking String() + } + + } + public final class FooInterface2Impl : R|FooInterface2| { + public constructor(): R|FooInterface2Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbGtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|kotlin/String| { + ^data3 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun R|kotlin/Int|.data3Blocking(): R|kotlin/String| + + } + public abstract interface FooInterface3 : R|kotlin/Any| { + public abstract suspend fun data(): R|kotlin/String| + + public open val dataBlocking: R|kotlin/String| + public get(): R|kotlin/String| { + ^ String() + } + + } + public final class FooInterface3Impl : R|FooInterface3| { + public constructor(): R|FooInterface3Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|(asProperty = Boolean(true)) @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override val dataBlocking: R|kotlin/String| + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public get(): R|kotlin/String| + + } + public abstract interface FooInterface4 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRudWxs)) public abstract suspend fun data(): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0bnVsbGtvdGxpbi9JbnQ=)) public abstract suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|kotlin/String| + + } + public final class FooInterface4Impl : R|FooInterface4| { + public constructor(): R|FooInterface4Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsbnVsbA==)) public open override suspend fun data(): R|kotlin/String| { + ^data String() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbG51bGxrb3RsaW4vSW50)) public open override suspend fun data2(value: R|kotlin/Int|): R|kotlin/String| { + ^data2 String() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|kotlin/Int|): R|kotlin/String| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|kotlin/String| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt new file mode 100644 index 0000000..5a915d0 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverriden.kt @@ -0,0 +1,74 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync + +interface FooInterface1 { + suspend fun data(): String + suspend fun data2(value: Int): String + suspend fun Int.data3(): String +} + +class FooInterface1Impl : FooInterface1 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): String = "" +} + +interface FooInterface2 { + suspend fun data(): String + fun dataBlocking(): String = "" + + suspend fun data2(value: Int): String + fun data2Blocking(value: Int): String = "" + + suspend fun Int.data3(): String + fun Int.data3Blocking(): String = "" +} + +class FooInterface2Impl : FooInterface2 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): String = "" +} + + +interface FooInterface3 { + suspend fun data(): String + val dataBlocking: String get() = "" +} + +class FooInterface3Impl : FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking(asProperty = true) + override suspend fun data(): String = "" +} + +interface FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): String + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: Int): String +} + +class FooInterface4Impl : FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): String = "" + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: Int): String = "" +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt new file mode 100644 index 0000000..2429b42 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.asm.txt @@ -0,0 +1,449 @@ +public abstract interface Bar : java/lang/Object, Foo { + +} + +public abstract interface Foo : java/lang/Object { + +} + +public abstract interface FooInterface1 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(java.lang.Object p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface1Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface1Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface1Impl this$0 + + void (FooInterface1Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface1Impl : java/lang/Object, FooInterface1 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(java.lang.Object value, kotlin.coroutines.Continuation $completion) + + public Bar data2Blocking(java.lang.Object value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Bar data3Blocking(int $this$data3Blocking) + + public Bar dataBlocking() +} + +public abstract interface FooInterface2 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(Foo p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) +} + +final class FooInterface2Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface2Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface2Impl this$0 + + void (FooInterface2Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface2Impl : java/lang/Object, FooInterface2 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(Foo value, kotlin.coroutines.Continuation $completion) + + public Foo data2Blocking(Foo value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Foo data3Blocking(int $this$data3Blocking) + + public Foo dataBlocking() +} + +public final class FooInterface3$DefaultImpls : java/lang/Object { + public static Foo data2Blocking(FooInterface3 $this, java.lang.Object value) + + public static Foo data3Blocking(FooInterface3 $this, int $receiver) + + public static Foo dataBlocking(FooInterface3 $this) +} + +final class FooInterface3$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3 this$0 + + void (FooInterface3 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface3 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(java.lang.Object p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data2Blocking(java.lang.Object p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data3Blocking(int p0) + + public abstract Foo dataBlocking() +} + +final class FooInterface3Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final java.lang.Object $value + + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, java.lang.Object $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface3Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface3Impl this$0 + + void (FooInterface3Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface3Impl : java/lang/Object, FooInterface3 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(java.lang.Object value, kotlin.coroutines.Continuation $completion) + + public Bar data2Blocking(java.lang.Object value) + + public Foo data2Blocking(java.lang.Object value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Bar data3Blocking(int $this$data3Blocking) + + public Foo data3Blocking(int $this$data3Blocking) + + public Bar dataBlocking() + + public Foo dataBlocking() +} + +public final class FooInterface4$DefaultImpls : java/lang/Object { + public static Foo data2Blocking(FooInterface4 $this, Foo value) + + public static Foo data3Blocking(FooInterface4 $this, int $receiver) + + public static Foo dataBlocking(FooInterface4 $this) +} + +final class FooInterface4$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4 this$0 + + void (FooInterface4 $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface FooInterface4 : java/lang/Object { + public abstract java.lang.Object data(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object data2(Foo p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data2Blocking(Foo p0) + + public abstract java.lang.Object data3(int p0, kotlin.coroutines.Continuation p1) + + public abstract Foo data3Blocking(int p0) + + public abstract Foo dataBlocking() +} + +final class FooInterface4Impl$data2Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Foo $value + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, Foo $value, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$data3Blocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $this_data3Blocking + + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, int $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class FooInterface4Impl$dataBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final FooInterface4Impl this$0 + + void (FooInterface4Impl $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class FooInterface4Impl : java/lang/Object, FooInterface4 { + public void () + + public java.lang.Object data(kotlin.coroutines.Continuation $completion) + + public java.lang.Object data2(Foo value, kotlin.coroutines.Continuation $completion) + + public Foo data2Blocking(Foo value) + + public java.lang.Object data3(int $this$data3, kotlin.coroutines.Continuation $completion) + + public Foo data3Blocking(int $this$data3Blocking) + + public Foo dataBlocking() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt new file mode 100644 index 0000000..7b2e294 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.ir.txt @@ -0,0 +1,669 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1.FooInterface1Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1Impl.FooInterface1Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Bar] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface1Impl.FooInterface1Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface1Impl modality:FINAL visibility:public superTypes:[.FooInterface1.FooInterface1Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2Blocking) returnType:T of .FooInterface1Impl + annotations: + Api4J + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface1Impl.data2Blocking): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data2Blocking' + CALL 'public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + : + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data2Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + value: GET_VAR 'value: A of .FooInterface1Impl.data2Blocking declared in .FooInterface1Impl.data2Blocking' type=A of .FooInterface1Impl.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.data3Blocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface1Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface1Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface1Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface1Impl declared in .FooInterface1Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' type=T of .FooInterface1Impl origin=null + $this: GET_VAR ': .FooInterface1Impl.FooInterface1Impl> declared in .FooInterface1Impl.dataBlocking' type=.FooInterface1Impl.FooInterface1Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface1 declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface1Impl.FooInterface1Impl>, value:A of .FooInterface1Impl.data2) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB") + JvmSynthetic + overridden: + public abstract fun data2 (value: A of .FooInterface1.data2): T of .FooInterface1 declared in .FooInterface1 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1Impl.data2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: A of .FooInterface1Impl.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface1Impl.FooInterface1Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface1Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface1 declared in .FooInterface1 + $this: VALUE_PARAMETER name: type:.FooInterface1Impl.FooInterface1Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface1Impl declared in .FooInterface1Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2.FooInterface2Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2Impl.FooInterface2Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface2Impl.FooInterface2Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface2Impl modality:FINAL visibility:public superTypes:[.FooInterface2.FooInterface2Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' + CALL 'public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data2Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + value: GET_VAR 'value: T of .FooInterface2Impl declared in .FooInterface2Impl.data2Blocking' type=T of .FooInterface2Impl origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.data3Blocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface2Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface2Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface2Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface2Impl declared in .FooInterface2Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' type=T of .FooInterface2Impl origin=null + $this: GET_VAR ': .FooInterface2Impl.FooInterface2Impl> declared in .FooInterface2Impl.dataBlocking' type=.FooInterface2Impl.FooInterface2Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, value:T of .FooInterface2Impl) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU") + JvmSynthetic + overridden: + public abstract fun data2 (value: T of .FooInterface2): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: T of .FooInterface2Impl): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface2Impl.FooInterface2Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface2Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface2 declared in .FooInterface2 + $this: VALUE_PARAMETER name: type:.FooInterface2Impl.FooInterface2Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface2Impl declared in .FooInterface2Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3.FooInterface3Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3Impl.FooInterface3Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Bar] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface3Impl.FooInterface3Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface3Impl modality:FINAL visibility:public superTypes:[.FooInterface3.FooInterface3Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2Blocking) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3Impl.data2Blocking): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data2Blocking' + CALL 'public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + : + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data2Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + value: GET_VAR 'value: A of .FooInterface3Impl.data2Blocking declared in .FooInterface3Impl.data2Blocking' type=A of .FooInterface3Impl.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.data3Blocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl + annotations: + Api4J + overridden: + public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3Impl declared in .FooInterface3Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' type=T of .FooInterface3Impl origin=null + $this: GET_VAR ': .FooInterface3Impl.FooInterface3Impl> declared in .FooInterface3Impl.dataBlocking' type=.FooInterface3Impl.FooInterface3Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN ($this:.FooInterface3Impl.FooInterface3Impl>, value:A of .FooInterface3Impl.data2) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB") + JvmSynthetic + overridden: + public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3 + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3Impl.data2 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: A of .FooInterface3Impl.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface3Impl.FooInterface3Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface3Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3 + $this: VALUE_PARAMETER name: type:.FooInterface3Impl.FooInterface3Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface3Impl declared in .FooInterface3Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4.FooInterface4Impl>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4Impl.FooInterface4Impl> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + CONSTRUCTOR visibility:public <> () returnType:.FooInterface4Impl.FooInterface4Impl> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooInterface4Impl modality:FINAL visibility:public superTypes:[.FooInterface4.FooInterface4Impl>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' + CALL 'public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data2Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + value: GET_VAR 'value: T of .FooInterface4Impl declared in .FooInterface4Impl.data2Blocking' type=T of .FooInterface4Impl origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.data3Blocking' + CALL 'public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.data3Blocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4Impl.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl + annotations: + Api4J + overridden: + public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4Impl> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4Impl [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4Impl declared in .FooInterface4Impl.dataBlocking' + CALL 'public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' type=T of .FooInterface4Impl origin=null + $this: GET_VAR ': .FooInterface4Impl.FooInterface4Impl> declared in .FooInterface4Impl.dataBlocking' type=.FooInterface4Impl.FooInterface4Impl> origin=null + FUN name:data visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==") + JvmSynthetic + overridden: + public abstract fun data (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data2 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, value:T of .FooInterface4Impl) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU") + JvmSynthetic + overridden: + public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4Impl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2 (value: T of .FooInterface4Impl): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:data3 visibility:public modality:OPEN <> ($this:.FooInterface4Impl.FooInterface4Impl>, $receiver:kotlin.Int) returnType:T of .FooInterface4Impl [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=") + JvmSynthetic + overridden: + public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4 + $this: VALUE_PARAMETER name: type:.FooInterface4Impl.FooInterface4Impl> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3 (): T of .FooInterface4Impl declared in .FooInterface4Impl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + CLASS INTERFACE name:Bar modality:ABSTRACT visibility:public superTypes:[.Foo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:FooInterface1 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface1.FooInterface1> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface1.FooInterface1>) returnType:T of .FooInterface1 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface1.FooInterface1>, value:A of .FooInterface1.data2) returnType:T of .FooInterface1 [suspend] + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface1.data2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface1.FooInterface1>, $receiver:kotlin.Int) returnType:T of .FooInterface1 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface1.FooInterface1> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface2 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface2.FooInterface2> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>, value:T of .FooInterface2) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface2.FooInterface2>, $receiver:kotlin.Int) returnType:T of .FooInterface2 [suspend] + $this: VALUE_PARAMETER name: type:.FooInterface2.FooInterface2> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface3 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface3.FooInterface3> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2Blocking) returnType:T of .FooInterface3 + annotations: + Api4J + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2Blocking + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: A of .FooInterface3.data2Blocking): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data2Blocking' + CALL 'public abstract fun data2 (value: A of .FooInterface3.data2): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + : + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data2Blocking' type=.FooInterface3.FooInterface3> origin=null + value: GET_VAR 'value: A of .FooInterface3.data2Blocking declared in .FooInterface3.data2Blocking' type=A of .FooInterface3.data2Blocking origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.data3Blocking' + CALL 'public abstract fun data3 (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.data3Blocking' type=.FooInterface3.FooInterface3> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface3.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface3 declared in .FooInterface3' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface3> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface3 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface3 declared in .FooInterface3.dataBlocking' + CALL 'public abstract fun data (): T of .FooInterface3 declared in .FooInterface3' type=T of .FooInterface3 origin=null + $this: GET_VAR ': .FooInterface3.FooInterface3> declared in .FooInterface3.dataBlocking' type=.FooInterface3.FooInterface3> origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + FUN name:data2 visibility:public modality:ABSTRACT ($this:.FooInterface3.FooInterface3>, value:A of .FooInterface3.data2) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=") + JvmSynthetic + TYPE_PARAMETER name:A index:0 variance: superTypes:[kotlin.Any?] reified:false + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface3.FooInterface3>, $receiver:kotlin.Int) returnType:T of .FooInterface3 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface3.FooInterface3> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + CLASS INTERFACE name:FooInterface4 modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooInterface4.FooInterface4> + TYPE_PARAMETER name:T index:0 variance: superTypes:[.Foo] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data2Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data2Blocking (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data2Blocking' + CALL 'public abstract fun data2 (value: T of .FooInterface4): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data2Blocking' type=.FooInterface4.FooInterface4> origin=null + value: GET_VAR 'value: T of .FooInterface4 declared in .FooInterface4.data2Blocking' type=T of .FooInterface4 origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:data3Blocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + $receiver: VALUE_PARAMETER name: type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun data3Blocking (): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.data3Blocking' + CALL 'public abstract fun data3 (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.data3Blocking' type=.FooInterface4.FooInterface4> origin=null + $receiver: GET_VAR ': kotlin.Int declared in .FooInterface4.data3Blocking' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:dataBlocking visibility:public modality:OPEN <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun dataBlocking (): T of .FooInterface4 declared in .FooInterface4' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.FooInterface4> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .FooInterface4 [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .FooInterface4 declared in .FooInterface4.dataBlocking' + CALL 'public abstract fun data (): T of .FooInterface4 declared in .FooInterface4' type=T of .FooInterface4 origin=null + $this: GET_VAR ': .FooInterface4.FooInterface4> declared in .FooInterface4.dataBlocking' type=.FooInterface4.FooInterface4> origin=null + FUN name:data visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + FUN name:data2 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, value:T of .FooInterface4) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + VALUE_PARAMETER name:value index:0 type:T of .FooInterface4 + FUN name:data3 visibility:public modality:ABSTRACT <> ($this:.FooInterface4.FooInterface4>, $receiver:kotlin.Int) returnType:T of .FooInterface4 [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.FooInterface4.FooInterface4> + $receiver: VALUE_PARAMETER name: type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt new file mode 100644 index 0000000..50347f6 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.fir.txt @@ -0,0 +1,145 @@ +FILE: Main.kt + public abstract interface Foo : R|kotlin/Any| { + } + public abstract interface Bar : R|Foo| { + } + public abstract interface FooInterface1 : R|kotlin/Any| { + public abstract suspend fun data(): R|T| + + public abstract suspend fun data2(value: R|A|): R|T| + + public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + } + public final class FooInterface1Impl : R|FooInterface1| { + public constructor(): R|FooInterface1Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTFJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UxSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UxSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface2 : R|kotlin/Any| { + public abstract suspend fun data(): R|T| + + public abstract suspend fun data2(value: R|T|): R|T| + + public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + } + public final class FooInterface2Impl : R|FooInterface2| { + public constructor(): R|FooInterface2Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTJJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UySW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UySW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface3 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTM8VD5udWxs)) public abstract suspend fun data(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzPFQ+bnVsbEE=)) public abstract suspend fun data2(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzPFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public final class FooInterface3Impl : R|FooInterface3| { + public constructor(): R|FooInterface3Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTNJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2UzSW1wbDxUPm51bGxB)) public open override suspend fun data2(value: R|A|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2UzSW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|A|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public abstract interface FooInterface4 : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTQ8VD5udWxs)) public abstract suspend fun data(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0PFQ+bnVsbFQ=)) public abstract suspend fun data2(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0PFQ+a290bGluL0ludA==)) public abstract suspend fun R|kotlin/Int|.data3(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } + public final class FooInterface4Impl : R|FooInterface4| { + public constructor(): R|FooInterface4Impl| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YUZvb0ludGVyZmFjZTRJbXBsPFQ+bnVsbA==)) public open override suspend fun data(): R|T| { + ^data R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTJGb29JbnRlcmZhY2U0SW1wbDxUPm51bGxU)) public open override suspend fun data2(value: R|T|): R|T| { + ^data2 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGF0YTNGb29JbnRlcmZhY2U0SW1wbDxUPmtvdGxpbi9JbnQ=)) public open override suspend fun R|kotlin/Int|.data3(): R|T| { + ^data3 R|kotlin/TODO|() + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun data2Blocking(value: R|T|): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open override fun dataBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun R|kotlin/Int|.data3Blocking(): R|T| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt new file mode 100644 index 0000000..e2c1e26 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/implOverridenGeneric.kt @@ -0,0 +1,83 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +interface Foo +interface Bar : Foo + + +interface FooInterface1 { + suspend fun data(): T + suspend fun data2(value: A): T + suspend fun Int.data3(): T +} + +class FooInterface1Impl : FooInterface1 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: A): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface2 { + suspend fun data(): T + suspend fun data2(value: T): T + suspend fun Int.data3(): T +} + +class FooInterface2Impl : FooInterface2 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: T): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: A): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun Int.data3(): T +} + +class FooInterface3Impl : FooInterface3 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: A): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + +interface FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data(): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun data2(value: T): T + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + suspend fun Int.data3(): T +} + +class FooInterface4Impl : FooInterface4 { + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data(): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun data2(value: T): T = TODO() + + @love.forte.plugin.suspendtrans.annotation.JvmBlocking + override suspend fun Int.data3(): T = TODO() +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt new file mode 100644 index 0000000..153e73d --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.asm.txt @@ -0,0 +1,53 @@ +public abstract interface OneOptAnno : java/lang/Object, java/lang/annotation/Annotation { + +} + +final class OptInTest$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final OptInTest this$0 + + void (OptInTest $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class OptInTest$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final OptInTest this$0 + + void (OptInTest $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public final class OptInTest : java/lang/Object { + public void () + + public final static java.lang.Object access$run0(OptInTest $this, kotlin.coroutines.Continuation $completion) + + public final java.lang.Object run(kotlin.coroutines.Continuation $completion) + + private final java.lang.Object run0(kotlin.coroutines.Continuation $completion) + + public final java.util.concurrent.CompletableFuture runAsync() + + public final int runBlocking() +} + +public abstract interface Values : java/lang/Object, java/lang/annotation/Annotation { + public abstract java.lang.Class target() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt new file mode 100644 index 0000000..9156a3a --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.ir.txt @@ -0,0 +1,122 @@ +FILE fqName: fileName:/Main.kt + CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation] + annotations: + RequiresOptIn(message = , level = GET_ENUM 'ENUM_ENTRY name:ERROR' type=kotlin.RequiresOptIn.Level) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.OneOptAnno + CONSTRUCTOR visibility:public <> () returnType:.OneOptAnno [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS ANNOTATION_CLASS name:Values modality:OPEN visibility:public superTypes:[kotlin.Annotation] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Values + PROPERTY name:target visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:target type:kotlin.reflect.KClass<*> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'target: kotlin.reflect.KClass<*> declared in .Values.' type=kotlin.reflect.KClass<*> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Values) returnType:kotlin.reflect.KClass<*> + correspondingProperty: PROPERTY name:target visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Values + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.reflect.KClass<*> declared in .Values' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:target type:kotlin.reflect.KClass<*> visibility:private [final]' type=kotlin.reflect.KClass<*> origin=null + receiver: GET_VAR ': .Values declared in .Values.' type=.Values origin=null + CONSTRUCTOR visibility:public <> (target:kotlin.reflect.KClass<*>) returnType:.Values [primary] + VALUE_PARAMETER name:target index:0 type:kotlin.reflect.KClass<*> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ANNOTATION_CLASS name:Values modality:OPEN visibility:public superTypes:[kotlin.Annotation]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Annotation + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.OptInTest + CONSTRUCTOR visibility:public <> () returnType:.OptInTest [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:FINAL <> ($this:.OptInTest) returnType:java.util.concurrent.CompletableFuture + annotations: + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + Api4J + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun runAsync (): java.util.concurrent.CompletableFuture declared in .OptInTest' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .OptInTest.runAsync' + CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.runAsync' type=.OptInTest origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int + annotations: + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + Api4J + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun runBlocking (): kotlin.Int declared in .OptInTest' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .OptInTest.runBlocking' + CALL 'public final fun run (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.runBlocking' type=.OptInTest origin=null + FUN name:run visibility:public modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] + annotations: + OptIn(markerClass = [CLASS_REFERENCE 'CLASS ANNOTATION_CLASS name:OneOptAnno modality:OPEN visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass<.OneOptAnno>] type=kotlin.Array> varargElementType=kotlin.reflect.KClass) + Values(target = CLASS_REFERENCE 'CLASS CLASS name:OptInTest modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.reflect.KClass<.OptInTest>) + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuT3B0SW5UZXN0bnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun run (): kotlin.Int declared in .OptInTest' + CALL 'private final fun run0 (): kotlin.Int declared in .OptInTest' type=kotlin.Int origin=null + $this: GET_VAR ': .OptInTest declared in .OptInTest.run' type=.OptInTest origin=null + FUN name:run0 visibility:private modality:FINAL <> ($this:.OptInTest) returnType:kotlin.Int [suspend] + annotations: + OneOptAnno + $this: VALUE_PARAMETER name: type:.OptInTest + BLOCK_BODY + RETURN type=kotlin.Nothing from='private final fun run0 (): kotlin.Int declared in .OptInTest' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt new file mode 100644 index 0000000..5a12831 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.fir.txt @@ -0,0 +1,34 @@ +FILE: Main.kt + @R|kotlin/RequiresOptIn|(level = Q|kotlin/RequiresOptIn.Level|.R|kotlin/RequiresOptIn.Level.ERROR|) public final annotation class OneOptAnno : R|kotlin/Annotation| { + public constructor(): R|OneOptAnno| { + super() + } + + } + public final annotation class Values : R|kotlin/Annotation| { + public constructor(target: R|kotlin/reflect/KClass<*>|): R|Values| { + super() + } + + public final val target: R|kotlin/reflect/KClass<*>| = R|/target| + public get(): R|kotlin/reflect/KClass<*>| + + } + public final class OptInTest : R|kotlin/Any| { + public constructor(): R|OptInTest| { + super() + } + + @R|OneOptAnno|() private final suspend fun run0(): R|kotlin/Int| { + ^run0 Int(1) + } + + @R|kotlin/OptIn|(markerClass = vararg((Q|OneOptAnno|))) @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuT3B0SW5UZXN0bnVsbA==)) public final suspend fun run(): R|kotlin/Int| { + ^run this@R|/OptInTest|.R|/OptInTest.run0|() + } + + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runAsync(): R|java/util/concurrent/CompletableFuture| + + @R|Values|(target = (Q|OptInTest|)) @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public final fun runBlocking(): R|kotlin/Int| + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt new file mode 100644 index 0000000..8278602 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/opt.kt @@ -0,0 +1,27 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.suspendCancellableCoroutine +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking +import kotlin.annotation.AnnotationRetention.SOURCE +import kotlin.coroutines.resume +import kotlin.reflect.KClass + +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) +annotation class OneOptAnno + +annotation class Values(val target: KClass<*>) + +class OptInTest { + @OneOptAnno + private suspend fun run0() = 1 + + @OptIn(OneOptAnno::class) + @Values(OptInTest::class) + @JvmBlocking + @JvmAsync + suspend fun run(): Int = run0() +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt new file mode 100644 index 0000000..bdc9c08 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.asm.txt @@ -0,0 +1,131 @@ +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.lang.Object run(Foo $this, java.lang.String name, kotlin.coroutines.Continuation $completion) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this) + + public static java.util.concurrent.CompletableFuture runAsync(Foo $this, int n) + + public static Bar runBlocking(Foo $this) + + public static Bar runBlocking(Foo $this, int n) +} + +final class Foo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object, IFoo { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) + + public abstract java.lang.Object run(java.lang.String p0, kotlin.coroutines.Continuation p1) + + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync() + + public abstract Bar runBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object run(kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(java.lang.String name, kotlin.coroutines.Continuation $completion) + + public java.lang.Object run(int n, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture runAsync() + + public java.util.concurrent.CompletableFuture runAsync(int n) + + public Bar runBlocking() + + public Bar runBlocking(int n) +} + +public final class IFoo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture runAsync(IFoo $this, int n) + + public static Bar runBlocking(IFoo $this, int n) +} + +final class IFoo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class IFoo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $n + + int label + + final IFoo this$0 + + void (IFoo $receiver, int $n, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface IFoo : java/lang/Object { + public abstract java.lang.Object run(int p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync(int p0) + + public abstract Bar runBlocking(int p0) +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt new file mode 100644 index 0000000..dcd2dec --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.ir.txt @@ -0,0 +1,238 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun run (): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (n: kotlin.Int): .Bar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + FUN name:run visibility:public modality:OPEN <> ($this:.FooImpl, name:kotlin.String) returnType:.Tar [suspend] + overridden: + public open fun run (name: kotlin.String): .Tar declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[.IFoo] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .IFoo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.Foo) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null + $this: GET_VAR ': .Foo declared in .Foo.runAsync' type=.Foo origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.Foo) returnType:.Bar + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (): .Bar declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .Foo.runBlocking' + CALL 'public abstract fun run (): .Bar declared in .Foo' type=.Bar origin=null + $this: GET_VAR ': .Foo declared in .Foo.runBlocking' type=.Foo origin=null + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo) returnType:.Bar [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuRm9vbnVsbA==") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Foo, n:kotlin.Int) returnType:.Bar [suspend] + overridden: + public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + FUN name:run visibility:public modality:OPEN <> ($this:.Foo, name:kotlin.String) returnType:.Tar [suspend] + $this: VALUE_PARAMETER name: type:.Foo + VALUE_PARAMETER name:name index:0 type:kotlin.String + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (name: kotlin.String): .Tar declared in .Foo' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.IFoo + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (n: kotlin.Int): java.util.concurrent.CompletableFuture declared in .IFoo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .IFoo.runAsync' + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runAsync' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runAsync' type=kotlin.Int origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (n: kotlin.Int): .Bar declared in .IFoo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0<.Bar> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.Bar [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .Bar declared in .IFoo.runBlocking' + CALL 'public abstract fun run (n: kotlin.Int): .Bar declared in .IFoo' type=.Bar origin=null + $this: GET_VAR ': .IFoo declared in .IFoo.runBlocking' type=.IFoo origin=null + n: GET_VAR 'n: kotlin.Int declared in .IFoo.runBlocking' type=kotlin.Int origin=null + FUN name:run visibility:public modality:ABSTRACT <> ($this:.IFoo, n:kotlin.Int) returnType:.Bar [suspend] + annotations: + TargetMarker(value = "cnVuSUZvb251bGxrb3RsaW4vSW50") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.IFoo + VALUE_PARAMETER name:n index:0 type:kotlin.Int diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt new file mode 100644 index 0000000..16a577c --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.fir.txt @@ -0,0 +1,53 @@ +FILE: Main.kt + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() public abstract interface IFoo : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuSUZvb251bGxrb3RsaW4vSW50)) public abstract suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(n: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(n: R|kotlin/Int|): R|Bar| + + } + public abstract interface Foo : R|IFoo| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vbnVsbA==)) public abstract suspend fun run(): R|Bar| + + public open suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public abstract override suspend fun run(n: R|kotlin/Int|): R|Bar| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(): R|Bar| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun run(): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(name: R|kotlin/String|): R|Tar| { + ^run R|/Tar.Tar|() + } + + public open override suspend fun run(n: R|kotlin/Int|): R|Bar| { + ^run R|/Tar.Tar|() + } + + } + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt new file mode 100644 index 0000000..aa0e5b2 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/override.kt @@ -0,0 +1,29 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +@JvmBlocking +@JvmAsync +interface IFoo { + suspend fun run(n: Int): Bar +} + +interface Foo : IFoo { + @JvmBlocking + @JvmAsync + suspend fun run(): Bar + suspend fun run(name:String): Tar = Tar() + override suspend fun run(n: Int): Bar +} + +class FooImpl : Foo { + override suspend fun run(): Tar = Tar() + override suspend fun run(name:String): Tar = Tar() + override suspend fun run(n: Int): Bar = Tar() +} + +open class Bar +class Tar : Bar() diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt new file mode 100644 index 0000000..465ee38 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.asm.txt @@ -0,0 +1,121 @@ +public final class Api : java/lang/Object { + public void () +} + +public class Bar : java/lang/Object { + public void () +} + +public final class Foo$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture runAsync(Foo $this, Api api) + + public static java.lang.Object runBlocking(Foo $this, Api api) + + public static java.util.concurrent.CompletableFuture valueAsync(Foo $this) + + public static Bar valueBlocking(Foo $this) +} + +final class Foo$runAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final Foo this$0 + + void (Foo $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$runBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final Foo this$0 + + void (Foo $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$valueAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class Foo$valueBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + int label + + final Foo this$0 + + void (Foo $receiver, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface Foo : java/lang/Object { + public abstract java.lang.Object run(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture runAsync(Api p0) + + public abstract java.lang.Object runBlocking(Api p0) + + public abstract java.lang.Object value(kotlin.coroutines.Continuation p0) + + public abstract java.util.concurrent.CompletableFuture valueAsync() + + public abstract Bar valueBlocking() +} + +public final class FooImpl : java/lang/Object, Foo { + public void () + + public java.lang.Object run(Api api, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture runAsync(Api api) + + public java.lang.Object runBlocking(Api api) + + public java.lang.Object value(kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture valueAsync() + + public Tar valueBlocking() + + public Bar valueBlocking() +} + +public final class Tar : Bar { + public void () +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt new file mode 100644 index 0000000..b9e8fdf --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.ir.txt @@ -0,0 +1,218 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:Api modality:FINAL visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + CONSTRUCTOR visibility:public <> () returnType:.Api.Api> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Api modality:FINAL visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Bar + CONSTRUCTOR visibility:public <> () returnType:.Bar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Bar modality:OPEN visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.FooImpl + CONSTRUCTOR visibility:public <> () returnType:.FooImpl [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:FooImpl modality:FINAL visibility:public superTypes:[.Foo<.Tar>]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:runAsync visibility:public modality:OPEN ($this:.Foo<.Tar>, api:.Api.FooImpl.runAsync>) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.runAsync> + FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN ($this:.Foo<.Tar>, api:.Api.FooImpl.runBlocking>) returnType:R of .FooImpl.runBlocking [fake_override] + annotations: + Api4J + overridden: + public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.runBlocking> + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Foo + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:valueAsync visibility:public modality:OPEN <> ($this:.Foo<.Tar>) returnType:java.util.concurrent.CompletableFuture [fake_override] + annotations: + Api4J + overridden: + public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + FUN FAKE_OVERRIDE name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo<.Tar>) returnType:.Tar [fake_override] + annotations: + Api4J + overridden: + public open fun valueBlocking (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.Foo<.Tar> + FUN name:run visibility:public modality:OPEN ($this:.FooImpl, api:.Api.FooImpl.run>) returnType:R of .FooImpl.run [suspend] + overridden: + public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.FooImpl + VALUE_PARAMETER name:api index:0 type:.Api.FooImpl.run> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun run (api: .Api.FooImpl.run>): R of .FooImpl.run declared in .FooImpl' + CALL 'public final fun TODO (): kotlin.Nothing declared in kotlin' type=kotlin.Nothing origin=null + FUN name:value visibility:public modality:OPEN <> ($this:.FooImpl) returnType:.Tar [suspend] + overridden: + public abstract fun value (): T of .Foo declared in .Foo + $this: VALUE_PARAMETER name: type:.FooImpl + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun value (): .Tar declared in .FooImpl' + CONSTRUCTOR_CALL 'public constructor () declared in .Tar' type=.Tar origin=null + CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tar + CONSTRUCTOR visibility:public <> () returnType:.Tar [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in .Bar' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tar modality:FINAL visibility:public superTypes:[.Bar]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in .Bar + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Foo.Foo> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[.Bar] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runAsync visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runAsync (api: .Api.Foo.runAsync>): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.runAsync' + CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null + : + $this: GET_VAR ': .Foo.Foo> declared in .Foo.runAsync' type=.Foo.Foo> origin=null + api: GET_VAR 'api: .Api.Foo.runAsync> declared in .Foo.runAsync' type=.Api.Foo.runAsync> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.runBlocking>) returnType:R of .Foo.runBlocking + annotations: + Api4J + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runBlocking> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun runBlocking (api: .Api.Foo.runBlocking>): R of .Foo.runBlocking declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo.runBlocking> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.runBlocking [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): R of .Foo.runBlocking declared in .Foo.runBlocking' + CALL 'public abstract fun run (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' type=R of .Foo.run origin=null + : + $this: GET_VAR ': .Foo.Foo> declared in .Foo.runBlocking' type=.Foo.Foo> origin=null + api: GET_VAR 'api: .Api.Foo.runBlocking> declared in .Foo.runBlocking' type=.Api.Foo.runBlocking> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueAsync visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueAsync (): java.util.concurrent.CompletableFuture declared in .Foo' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:java.util.concurrent.CompletableFuture [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): java.util.concurrent.CompletableFuture declared in .Foo.valueAsync' + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueAsync' type=.Foo.Foo> origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:valueBlocking visibility:public modality:OPEN <> ($this:.Foo.Foo>) returnType:T of .Foo + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.Foo.Foo> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun valueBlocking (): T of .Foo declared in .Foo' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0.Foo> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:T of .Foo [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): T of .Foo declared in .Foo.valueBlocking' + CALL 'public abstract fun value (): T of .Foo declared in .Foo' type=T of .Foo origin=null + $this: GET_VAR ': .Foo.Foo> declared in .Foo.valueBlocking' type=.Foo.Foo> origin=null + FUN name:run visibility:public modality:ABSTRACT ($this:.Foo.Foo>, api:.Api.Foo.run>) returnType:R of .Foo.run [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "cnVuRm9vPFQ+bnVsbEFwaTxSPg==") + JvmSynthetic + TYPE_PARAMETER name:R index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.Foo.Foo> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.run> + FUN name:value visibility:public modality:ABSTRACT <> ($this:.Foo.Foo>) returnType:T of .Foo [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "dmFsdWVGb288VD5udWxs") + JvmSynthetic + $this: VALUE_PARAMETER name: type:.Foo.Foo> diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt new file mode 100644 index 0000000..cc5bfb9 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.fir.txt @@ -0,0 +1,47 @@ +FILE: Main.kt + public open class Bar : R|kotlin/Any| { + public constructor(): R|Bar| { + super() + } + + } + public final class Tar : R|Bar| { + public constructor(): R|Tar| { + super() + } + + } + public final class Api : R|kotlin/Any| { + public constructor(): R|Api| { + super() + } + + } + public abstract interface Foo : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(dmFsdWVGb288VD5udWxs)) public abstract suspend fun value(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(cnVuRm9vPFQ+bnVsbEFwaTxSPg==)) public abstract suspend fun run(api: R|Api|): R|R| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueAsync(): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun valueBlocking(): R|T| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun runBlocking(api: R|Api|): R|R| + + } + public final class FooImpl : R|Foo| { + public constructor(): R|FooImpl| { + super() + } + + public open override suspend fun value(): R|Tar| { + ^value R|/Tar.Tar|() + } + + public open override suspend fun run(api: R|Api|): R|R| { + ^run R|kotlin/TODO|() + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt new file mode 100644 index 0000000..164eb39 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttr.kt @@ -0,0 +1,32 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +open class Bar +class Tar : Bar() + +class Api + +interface Foo { + @JvmBlocking + @JvmAsync + suspend fun value(): T + + @JvmBlocking + @JvmAsync + suspend fun run(api: Api): R +} + +class FooImpl : Foo { + override suspend fun value(): Tar { + return Tar() + } + + override suspend fun run(api: Api): R { + return TODO() + } +} + diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt new file mode 100644 index 0000000..437a7ce --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.asm.txt @@ -0,0 +1,35 @@ +public abstract interface Api : java/lang/Object { + public abstract java.lang.Object run(kotlin.coroutines.Continuation p0) +} + +public final class ApiExecutable$DefaultImpls : java/lang/Object { + public static java.util.concurrent.CompletableFuture executeAsync(ApiExecutable $this, Api api) +} + +final class ApiExecutable$executeAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final Api $api + + int label + + final ApiExecutable this$0 + + void (ApiExecutable $receiver, Api $api, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract interface ApiExecutable : java/lang/Object { + public abstract java.lang.Object execute(Api p0, kotlin.coroutines.Continuation p1) + + public abstract java.util.concurrent.CompletableFuture executeAsync(Api p0) +} + +public abstract interface ApiResult : java/lang/Object { + +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt new file mode 100644 index 0000000..5436658 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.ir.txt @@ -0,0 +1,77 @@ +FILE fqName: fileName:/Main.kt + CLASS INTERFACE name:Api modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Api.Api> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:run visibility:public modality:ABSTRACT <> ($this:.Api.Api>) returnType:T of .Api [suspend] + $this: VALUE_PARAMETER name: type:.Api.Api> + CLASS INTERFACE name:ApiExecutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiExecutable + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:executeAsync visibility:public modality:OPEN ($this:.ApiExecutable, api:.Api.ApiExecutable.executeAsync>) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.executeAsync> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun executeAsync (api: .Api.ApiExecutable.executeAsync>): java.util.concurrent.CompletableFuture declared in .ApiExecutable' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable.executeAsync' + CALL 'public abstract fun execute (api: .Api.ApiExecutable.execute>): .ApiResult<.Api.ApiExecutable.execute>> declared in .ApiExecutable' type=.ApiResult<.Api.ApiExecutable.execute>> origin=null + : + $this: GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + api: GET_VAR 'api: .Api.ApiExecutable.executeAsync> declared in .ApiExecutable.executeAsync' type=.Api.ApiExecutable.executeAsync> origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .ApiExecutable declared in .ApiExecutable.executeAsync' type=.ApiExecutable origin=null + FUN name:execute visibility:public modality:ABSTRACT ($this:.ApiExecutable, api:.Api.ApiExecutable.execute>) returnType:.ApiResult<.Api.ApiExecutable.execute>> [suspend] + annotations: + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZXhlY3V0ZUFwaUV4ZWN1dGFibGVudWxsQXBpPFQ+") + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + $this: VALUE_PARAMETER name: type:.ApiExecutable + VALUE_PARAMETER name:api index:0 type:.Api.ApiExecutable.execute> + CLASS INTERFACE name:ApiResult modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.ApiResult.ApiResult> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] reified:false + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt new file mode 100644 index 0000000..d5b63b8 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.fir.txt @@ -0,0 +1,18 @@ +FILE: Main.kt + public abstract interface Api : R|kotlin/Any| { + public abstract suspend fun run(): R|T| + + } + public abstract interface ApiResult : R|kotlin/Any| { + } + public abstract interface ApiExecutable : R|kotlin/Any| { + @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZXhlY3V0ZUFwaUV4ZWN1dGFibGVudWxsQXBpPFQ+)) public abstract suspend fun execute(api: R|Api|): R|ApiResult>| + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun executeAsync(api: R|Api|): R|java/util/concurrent/CompletableFuture>>| { + ^executeAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|ApiResult>| { + ^ this@R|/ApiExecutable|.R|/ApiExecutable.execute|(R|/api|) + } + , (this@R|/ApiExecutable| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt new file mode 100644 index 0000000..39afb79 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/typeAttrNested.kt @@ -0,0 +1,17 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +interface Api { + suspend fun run(): T +} + +interface ApiResult + +interface ApiExecutable { + @JvmAsync + suspend fun execute(api: Api): ApiResult> +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt new file mode 100644 index 0000000..6035411 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.asm.txt @@ -0,0 +1,47 @@ +final class MyClass$deleteAllAsync$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +final class MyClass$deleteAllBlocking$1 : kotlin/coroutines/jvm/internal/SuspendLambda, kotlin/jvm/functions/Function1 { + final int $option + + int label + + final MyClass this$0 + + void (MyClass $receiver, int $option, kotlin.coroutines.Continuation $completion) + + public final kotlin.coroutines.Continuation create(kotlin.coroutines.Continuation $completion) + + public final java.lang.Object invoke(kotlin.coroutines.Continuation p1) + + public java.lang.Object invoke(java.lang.Object p1) + + public final java.lang.Object invokeSuspend(java.lang.Object $result) +} + +public abstract class MyClass : java/lang/Object { + public void () + + public java.lang.Object deleteAll(int option, kotlin.coroutines.Continuation $completion) + + static java.lang.Object deleteAll$suspendImpl(MyClass $this, int option, kotlin.coroutines.Continuation $completion) + + public java.util.concurrent.CompletableFuture deleteAllAsync(int option) + + public int deleteAllBlocking(int option) +} diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt new file mode 100644 index 0000000..ef335a7 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.ir.txt @@ -0,0 +1,64 @@ +FILE fqName: fileName:/Main.kt + CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.MyClass + CONSTRUCTOR visibility:public <> () returnType:.MyClass [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MyClass modality:ABSTRACT visibility:public superTypes:[kotlin.Any]' + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:deleteAllAsync visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:java.util.concurrent.CompletableFuture + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllAsync (option: kotlin.Int): java.util.concurrent.CompletableFuture declared in .MyClass' + CALL 'public final fun $runInAsync$ (block: kotlin.coroutines.SuspendFunction0, scope: kotlinx.coroutines.CoroutineScope?): java.util.concurrent.CompletableFuture declared in love.forte.plugin.suspendtrans.runtime' type=java.util.concurrent.CompletableFuture origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllAsync' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllAsync' type=kotlin.Int origin=null + scope: TYPE_OP type=kotlinx.coroutines.CoroutineScope? origin=SAFE_CAST typeOperand=kotlinx.coroutines.CoroutineScope + GET_VAR ': .MyClass declared in .MyClass.deleteAllAsync' type=.MyClass origin=null + FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:deleteAllBlocking visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int + annotations: + Api4J + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAllBlocking (option: kotlin.Int): kotlin.Int declared in .MyClass' + CALL 'public final fun $runInBlocking$ (block: kotlin.coroutines.SuspendFunction0): T of love.forte.plugin.suspendtrans.runtime.$runInBlocking$ declared in love.forte.plugin.suspendtrans.runtime' type=kotlin.Int origin=null + : + block: FUN_EXPR type=kotlin.coroutines.SuspendFunction0 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:kotlin.Int [suspend] + BLOCK_BODY + RETURN type=kotlin.Nothing from='local final fun (): kotlin.Int declared in .MyClass.deleteAllBlocking' + CALL 'public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' type=kotlin.Int origin=null + $this: GET_VAR ': .MyClass declared in .MyClass.deleteAllBlocking' type=.MyClass origin=null + option: GET_VAR 'option: kotlin.Int declared in .MyClass.deleteAllBlocking' type=kotlin.Int origin=null + FUN name:deleteAll visibility:public modality:OPEN <> ($this:.MyClass, option:kotlin.Int) returnType:kotlin.Int [suspend] + annotations: + JvmBlocking(baseName = , suffix = , asProperty = ) + JvmAsync(baseName = , suffix = , asProperty = ) + TargetMarker(value = "ZGVsZXRlQWxsTXlDbGFzc251bGxrb3RsaW4vSW50") + $this: VALUE_PARAMETER name: type:.MyClass + VALUE_PARAMETER name:option index:0 type:kotlin.Int + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun deleteAll (option: kotlin.Int): kotlin.Int declared in .MyClass' + CONST Int type=kotlin.Int value=1 diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt new file mode 100644 index 0000000..7833a8e --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.fir.txt @@ -0,0 +1,25 @@ +FILE: Main.kt + public abstract class MyClass : R|kotlin/Any| { + public constructor(): R|MyClass| { + super() + } + + @R|love/forte/plugin/suspendtrans/annotation/JvmBlocking|() @R|love/forte/plugin/suspendtrans/annotation/JvmAsync|() @R|love/forte/plugin/suspendtrans/annotation/TargetMarker|(value = String(ZGVsZXRlQWxsTXlDbGFzc251bGxrb3RsaW4vSW50)) public open suspend fun deleteAll(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAll Int(1) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllAsync(option: R|kotlin/Int|): R|java/util/concurrent/CompletableFuture| { + ^deleteAllAsync R|love/forte/plugin/suspendtrans/runtime/$runInAsync$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + , (this@R|/MyClass| as? R|kotlinx/coroutines/CoroutineScope|)) + } + + @R|love/forte/plugin/suspendtrans/annotation/Api4J|() public open fun deleteAllBlocking(option: R|kotlin/Int|): R|kotlin/Int| { + ^deleteAllBlocking R|love/forte/plugin/suspendtrans/runtime/$runInBlocking$|(suspend fun (): R|kotlin/Int| { + ^ this@R|/MyClass|.R|/MyClass.deleteAll|(R|/option|) + } + ) + } + + } diff --git a/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt new file mode 100644 index 0000000..35c8c67 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData_2/codegen/varargParam.kt @@ -0,0 +1,19 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import kotlinx.coroutines.runBlocking +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + + +abstract class MyClass { + @JvmBlocking + @JvmAsync + suspend open fun deleteAll(option: Int): Int { + return 1 + } + +} + diff --git a/tests/test-js/build.gradle.kts b/tests/test-js/build.gradle.kts index 92a1650..f215be2 100644 --- a/tests/test-js/build.gradle.kts +++ b/tests/test-js/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.9.4") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.11.0") } } @@ -35,6 +35,7 @@ kotlin { js(IR) { nodejs() + useEsModules() generateTypeScriptDefinitions() binaries.executable() @@ -50,13 +51,15 @@ kotlin { } sourceSets { - named("jsMain") { - dependencies { - implementation(kotlin("stdlib")) - api(libs.kotlinx.coroutines.core) - api(project(":runtime:suspend-transform-annotation")) - api(project(":runtime:suspend-transform-runtime")) - } + jsMain.dependencies { + implementation(kotlin("stdlib")) + implementation(libs.kotlinx.coroutines.core) + implementation(project(":runtime:suspend-transform-annotation")) + implementation(project(":runtime:suspend-transform-runtime")) + } + jsTest.dependencies { + implementation(kotlin("test")) + implementation(libs.kotlinx.coroutines.test) } } } diff --git a/tests/test-js/src/jsMain/kotlin/AsPropertyTests.kt b/tests/test-js/src/jsMain/kotlin/AsPropertyInterface.kt similarity index 100% rename from tests/test-js/src/jsMain/kotlin/AsPropertyTests.kt rename to tests/test-js/src/jsMain/kotlin/AsPropertyInterface.kt diff --git a/tests/test-js/src/jsMain/kotlin/Main.kt b/tests/test-js/src/jsMain/kotlin/Main.kt index 6e15fba..3165099 100644 --- a/tests/test-js/src/jsMain/kotlin/Main.kt +++ b/tests/test-js/src/jsMain/kotlin/Main.kt @@ -1,10 +1,9 @@ +import kotlinx.coroutines.await import kotlin.js.Promise suspend fun main() { -// runInAsync(block = SuspendFun()).await() - Promise // keep import - println(ForteScarlet().stringToInt("1")) -// println(ForteScarlet().stringToIntAsync("1")) -// println(ForteScarlet().stringToIntAsync("1").await()) + println(ForteScarlet().asDynamic().stringToIntAsync("1")) + println(ForteScarlet().asDynamic().stringToIntAsync("1").unsafeCast>().await()) + } diff --git a/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt b/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt new file mode 100644 index 0000000..2907aad --- /dev/null +++ b/tests/test-js/src/jsTest/kotlin/AsPropertyTest.kt @@ -0,0 +1,21 @@ +import kotlinx.coroutines.await +import kotlinx.coroutines.test.runTest +import kotlin.js.Promise +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs + +/** + * + * @author ForteScarlet + */ +class AsPropertyTest { + + @Test + fun testAsProperty() = runTest { + val impl = AsPropertyImpl() + assertIs>(impl.asDynamic().valueAsync) + assertEquals("Hello, World", impl.asDynamic().valueAsync.unsafeCast>().await()) + } + +} diff --git a/tests/test-js/src/jsTest/kotlin/PromiseTest.kt b/tests/test-js/src/jsTest/kotlin/PromiseTest.kt new file mode 100644 index 0000000..d4f4dcf --- /dev/null +++ b/tests/test-js/src/jsTest/kotlin/PromiseTest.kt @@ -0,0 +1,21 @@ +import kotlinx.coroutines.await +import kotlinx.coroutines.test.runTest +import kotlin.js.Promise +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertIs + +/** + * + * @author ForteScarlet + */ +class PromiseTest { + + @Test + fun testPromise() = runTest { + assertEquals(1, ForteScarlet().stringToInt("1")) + assertIs>(ForteScarlet().asDynamic().stringToIntAsync("1")) + assertEquals(1, ForteScarlet().asDynamic().stringToIntAsync("1").unsafeCast>().await()) + } + +} diff --git a/tests/test-jvm/build.gradle.kts b/tests/test-jvm/build.gradle.kts index c254dda..5dbc007 100644 --- a/tests/test-jvm/build.gradle.kts +++ b/tests/test-jvm/build.gradle.kts @@ -19,7 +19,7 @@ buildscript { mavenCentral() } dependencies { - classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.9.4") + classpath("love.forte.plugin.suspend-transform:suspend-transform-plugin-gradle:2.1.0-0.11.0") } } diff --git a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt new file mode 100644 index 0000000..3447091 --- /dev/null +++ b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/AcceptSupport.kt @@ -0,0 +1,44 @@ +package love.forte.plugin.suspendtrans.sample + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +/** + * 对“接受行为”的支持,由 [RequestEvent] 实现。 + * + * @author ForteScarlet + */ +interface AcceptSupport { + /** + * 接受此请求。 + * + * @throws Throwable 任何可能产生的错误。 + */ + @JvmBlocking + @JvmAsync + suspend fun accept() + + /** + * 接受此请求。 + * + * 对实现者:此函数具有默认实现以确保二进制兼容。 + * + * @param options 用于当前接受行为的可选项。 + * 如果某选项实现不支持则会被忽略,支持的范围由实现者决定。 + * @since 4.0.0-RC3 + * @throws Throwable 任何可能产生的错误。 + */ + @JvmBlocking + @JvmAsync + suspend fun accept(vararg options: AcceptOption) { + accept() + } +} + +/** + * [AcceptSupport.accept] 的可选项。 + * [AcceptOption] 可以自由扩展,且如果遇到不支持的实现则会将其忽略。 + * + * @see AcceptSupport.accept + */ +interface AcceptOption diff --git a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt index e3a3c1e..799b8c8 100644 --- a/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt +++ b/tests/test-jvm/src/main/kotlin/love/forte/plugin/suspendtrans/sample/ApiExecutable.kt @@ -18,4 +18,7 @@ interface ApiExecutable { @JvmAsync suspend fun execute2(api: Api): ApiResult + + @JvmAsync + suspend fun execute3(api: Api): ApiResult> } diff --git a/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt b/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt index 93f9407..6df947e 100644 --- a/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt +++ b/tests/test-jvm/src/test/kotlin/SuspendTransformTests.kt @@ -26,10 +26,7 @@ import java.lang.reflect.Modifier import java.util.concurrent.CompletableFuture import kotlin.reflect.KTypeParameter import kotlin.reflect.full.memberProperties -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFalse -import kotlin.test.assertTrue +import kotlin.test.* @JvmBlocking @@ -61,6 +58,11 @@ interface TypedTrans1Impl : ITypedTrans1 { override suspend fun value(): T } +class STPTrans1Impl : STPTrans1 { + override suspend fun run1(): Int = 1 + override suspend fun run2(): String = "run2" +} + /** * * @author ForteScarlet @@ -125,7 +127,6 @@ class SuspendTransformTests { } - @Test fun `typed interface test`() { with(ITypedTrans1::class) { @@ -149,4 +150,27 @@ class SuspendTransformTests { }) } } + + @Test + fun `invoke test`() { + val stp = STPTrans1Impl() + + val run1BlockingMethod = STPTrans1::class.java.getMethod("getRun1") + val run2BlockingMethod = STPTrans1::class.java.getMethod("getRun2") + + val run1AsyncMethod = STPTrans1::class.java.getMethod("getRun1Ay") + val run2AsyncMethod = STPTrans1::class.java.getMethod("getRun2Ay") + + assertEquals(1, run1BlockingMethod.invoke(stp)) + assertEquals("run2", run2BlockingMethod.invoke(stp)) + + val run1Async = run1AsyncMethod.invoke(stp) + val run2Async = run2AsyncMethod.invoke(stp) + + assertIs>(run1Async) + assertIs>(run2Async) + + assertEquals(1, run1Async.get()) + assertEquals("run2", run2Async.get()) + } } From 34b29f047af3e463370c6d38600049d210466cd6 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 03:07:10 +0800 Subject: [PATCH 08/11] Improved transformer initialization, improved exceptions, improved parameter padding --- .../fir/SuspendTransformFirTransformer.kt | 113 +++++++++++++----- .../runners/CodeGenTestRunnerGenerated.java | 6 + .../src/testData/codegen/async.kt | 12 ++ 3 files changed, 100 insertions(+), 31 deletions(-) create mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/async.kt diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 1b5665c..46f114d 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.fir.references.builder.buildResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl import org.jetbrains.kotlin.fir.resolve.getSuperTypes +import org.jetbrains.kotlin.fir.resolve.providers.dependenciesSymbolProvider import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider import org.jetbrains.kotlin.fir.resolve.toRegularClassSymbol import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve @@ -90,22 +91,29 @@ class SuspendTransformFirTransformer( ) private fun initScopeSymbol() { - coroutineScopeSymbol = session.symbolProvider.getClassLikeSymbolByClassId( - ClassId( - FqName.fromSegments(listOf("kotlinx", "coroutines")), - Name.identifier("CoroutineScope") - ) - ) ?: error("Cannot resolve `kotlinx.coroutines.CoroutineScope` symbol.") + + val classId = ClassId( + FqName.fromSegments(listOf("kotlinx", "coroutines")), + Name.identifier("CoroutineScope") + ) + + coroutineScopeSymbol = session.symbolProvider.getClassLikeSymbolByClassId(classId) + ?: session.dependenciesSymbolProvider.getClassLikeSymbolByClassId(classId) + ?: error("Cannot resolve `kotlinx.coroutines.CoroutineScope` symbol.") } private fun initTransformerFunctionSymbolMap() { // 尝试找到所有配置的 bridge function, 例如 `runBlocking` 等 + val symbolProvider = session.symbolProvider + val dependenciesSymbolProvider = session.dependenciesSymbolProvider + suspendTransformConfiguration.transformers - .forEach { (_, transformerList) -> + .forEach { (platform, transformerList) -> for (transformer in transformerList) { val transformFunctionInfo = transformer.transformFunctionInfo val packageName = transformFunctionInfo.packageName val functionName = transformFunctionInfo.functionName + @Suppress("DEPRECATION") val className = transformFunctionInfo.className if (className != null) { @@ -117,11 +125,18 @@ class SuspendTransformFirTransformer( // TODO 校验funcs? + val functionNameIdentifier = Name.identifier(functionName) + val transformerFunctionSymbols = - session.symbolProvider.getTopLevelFunctionSymbols( + symbolProvider.getTopLevelFunctionSymbols( packageName.fqn, - Name.identifier(functionName) - ) + functionNameIdentifier + ).ifEmpty { + dependenciesSymbolProvider.getTopLevelFunctionSymbols( + packageName.fqn, + functionNameIdentifier + ) + } if (transformerFunctionSymbols.isNotEmpty()) { if (transformerFunctionSymbols.size == 1) { @@ -130,7 +145,8 @@ class SuspendTransformFirTransformer( error("Found multiple transformer function symbols for transformer: $transformer") } } else { - error("Cannot find transformer function symbol for transformer: $transformer") + // 有时候在不同平台中寻找,可能会找不到,例如在jvm中找不到js的函数 + // error("Cannot find transformer function symbol $packageName.$functionName (${session.moduleData.platform}) for transformer: $transformer") } } } @@ -331,7 +347,6 @@ class SuspendTransformFirTransformer( } } - // TODO? this.contextReceiverArguments.addAll(thisContextReceivers.map { receiver -> buildThisReceiverExpression { coneTypeOrNull = receiver.typeRef.coneTypeOrNull @@ -390,13 +405,13 @@ class SuspendTransformFirTransformer( this.resolvedSymbol = bridgeFunSymbol } - // this.dispatchReceiver = buildThisReceiverExpression { - // coneTypeOrNull = originFunSymbol.dispatchReceiverType - // source = originFunSymbol.source - // calleeReference = buildImplicitThisReference { - // boundSymbol = owner - // } - // } + // this.dispatchReceiver = buildThisReceiverExpression { + // coneTypeOrNull = originFunSymbol.dispatchReceiverType + // source = originFunSymbol.source + // calleeReference = buildImplicitThisReference { + // boundSymbol = owner + // } + // } this.argumentList = buildResolvedArgumentList( null, @@ -416,21 +431,36 @@ class SuspendTransformFirTransformer( bridgeFunSymbol.valueParameterSymbols if (valueParameterSymbols.size > 1) { + // 支持: + // CoroutineScope? -> this as? CoroutineScope + // CoroutineScope -> this or throw error + // CoroutineScope (optional) -> this or ignore + // TODO Any -> this + // TODO 后面的所有参数处理 + +// val listIterator = valueParameterSymbols.listIterator(1) +// listIterator.forEach { otherParameter -> +// +// } + val secondParameter = valueParameterSymbols[1] val secondParameterType = secondParameter.resolvedReturnType val secondParameterTypeNotNullable = secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) - val isCoroutineScope = secondParameterTypeNotNullable.isSubtypeOf( - coroutineScopeSymbol.toLookupTag().constructClassType(), - session, - ) + fun ConeKotlinType.isCoroutineScope(): Boolean { + return isSubtypeOf( + coroutineScopeSymbol.toLookupTag().constructClassType(), + session + ) + } + + val isCoroutineScope = secondParameterTypeNotNullable.isCoroutineScope() if (isCoroutineScope) { if (secondParameterType.isMarkedNullable) { // this as? CoroutineScope - val secondParameterTypeNotNullable = secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull( session.typeContext @@ -458,15 +488,39 @@ class SuspendTransformFirTransformer( operation = FirOperation.SAFE_AS conversionTypeRef = secondParameterTypeNotNullable.toFirResolvedTypeRef() - }, secondParameter.fir ) } else { - // this as CoroutineScope - // or throw error? + // if this is CoroutineScope, put, or throw error? + + var ownerIsCoroutineScopeOrParameterIsOptional = secondParameter.hasDefaultValue + + for (superType in owner.getSuperTypes(session, recursive = false)) { + if (superType.isCoroutineScope()) { + put( + buildThisReceiverExpression { + coneTypeOrNull = originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + }, + secondParameter.fir + ) + ownerIsCoroutineScopeOrParameterIsOptional = true + break + } + } + // or throw error? + if (!ownerIsCoroutineScopeOrParameterIsOptional) { + error( + "Owner is not a CoroutineScope, " + + "and the transformer function requires a `CoroutineScope` parameter." + ) + } } } @@ -535,10 +589,6 @@ class SuspendTransformFirTransformer( ), ) -// val returnType = resolveReturnType(originFunc, funData, returnTypeRef) -// returnTypeRef = returnType -// returnTypeRef = funData.bridgeFunData.returnType - // Copy the typeParameters. // Otherwise, in functions like the following, an error will occur // suspend fun data(value: A): T = ... @@ -869,6 +919,7 @@ class SuspendTransformFirTransformer( val anno = firAnnotation(func, markAnnotation, classSymbol) ?: continue + val transformerFunctionSymbol = transformerFunctionSymbolMap[transformer] ?: error("Cannot find transformer function symbol for transformer: $transformer") diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index d0d454a..79e9edf 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -32,6 +32,12 @@ public void testBasic() { runTest("src/testData/codegen/basic.kt"); } + @Test + @TestMetadata("async.kt") + public void testAsync() { + runTest("src/testData/codegen/async.kt"); + } + @Test @TestMetadata("override.kt") public void testOverride() { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/async.kt b/compiler/suspend-transform-plugin/src/testData/codegen/async.kt new file mode 100644 index 0000000..9231024 --- /dev/null +++ b/compiler/suspend-transform-plugin/src/testData/codegen/async.kt @@ -0,0 +1,12 @@ +// FIR_DUMP +// DUMP_IR +// SOURCE +// FILE: Main.kt [MainKt#main] + +import love.forte.plugin.suspendtrans.annotation.JvmAsync +import love.forte.plugin.suspendtrans.annotation.JvmBlocking + +class BasicFoo { + @JvmAsync + suspend fun foo(): String = "foo" +} From 534d20e559e8adb4735aaa993ed9ce5c3372f7b7 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 03:07:36 +0800 Subject: [PATCH 09/11] remove a temp test --- .../runners/CodeGenTestRunnerGenerated.java | 6 ------ .../src/testData/codegen/async.kt | 12 ------------ 2 files changed, 18 deletions(-) delete mode 100644 compiler/suspend-transform-plugin/src/testData/codegen/async.kt diff --git a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java index 79e9edf..d0d454a 100644 --- a/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java +++ b/compiler/suspend-transform-plugin/src/test-gen/love/forte/plugin/suspendtrans/runners/CodeGenTestRunnerGenerated.java @@ -32,12 +32,6 @@ public void testBasic() { runTest("src/testData/codegen/basic.kt"); } - @Test - @TestMetadata("async.kt") - public void testAsync() { - runTest("src/testData/codegen/async.kt"); - } - @Test @TestMetadata("override.kt") public void testOverride() { diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/async.kt b/compiler/suspend-transform-plugin/src/testData/codegen/async.kt deleted file mode 100644 index 9231024..0000000 --- a/compiler/suspend-transform-plugin/src/testData/codegen/async.kt +++ /dev/null @@ -1,12 +0,0 @@ -// FIR_DUMP -// DUMP_IR -// SOURCE -// FILE: Main.kt [MainKt#main] - -import love.forte.plugin.suspendtrans.annotation.JvmAsync -import love.forte.plugin.suspendtrans.annotation.JvmBlocking - -class BasicFoo { - @JvmAsync - suspend fun foo(): String = "foo" -} From abfee0be317c6c2f7ef56a9fb999c61367658b5c Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 03:09:32 +0800 Subject: [PATCH 10/11] Add some TODOs --- compiler/suspend-transform-plugin/build.gradle.kts | 1 + .../forte/plugin/suspendtrans/SuspendTransformConfiguration.kt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/compiler/suspend-transform-plugin/build.gradle.kts b/compiler/suspend-transform-plugin/build.gradle.kts index 6dea342..d67ccd3 100644 --- a/compiler/suspend-transform-plugin/build.gradle.kts +++ b/compiler/suspend-transform-plugin/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { implementation(kotlin("compiler")) compileOnly(libs.kotlinx.coroutines.core) api(libs.kotlinx.serialization.json) + // TODO 改成二进制的,比如 protobuf testImplementation("junit:junit:4.13.2") testImplementation(kotlin("stdlib")) diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt index e5b46af..9aede47 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/SuspendTransformConfiguration.kt @@ -2,6 +2,9 @@ package love.forte.plugin.suspendtrans import kotlinx.serialization.Serializable +// TODO 序列化改成二进制的,比如 protobuf, +// 然后使用base64或hash进行传递,避免谜之转义 + @Serializable data class FunctionInfo( var packageName: String, From 374f2715e1766beda66f16835abc7a375c0f6029 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 14 Feb 2025 15:34:38 +0800 Subject: [PATCH 11/11] Refactor parameter handling in SuspendTransformFirTransformer --- .../fir/SuspendTransformFirTransformer.kt | 132 +++++++++--------- 1 file changed, 63 insertions(+), 69 deletions(-) diff --git a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt index 46f114d..f479e4b 100644 --- a/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt +++ b/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt @@ -108,7 +108,7 @@ class SuspendTransformFirTransformer( val dependenciesSymbolProvider = session.dependenciesSymbolProvider suspendTransformConfiguration.transformers - .forEach { (platform, transformerList) -> + .forEach { (_, transformerList) -> for (transformer in transformerList) { val transformFunctionInfo = transformer.transformFunctionInfo val packageName = transformFunctionInfo.packageName @@ -435,19 +435,8 @@ class SuspendTransformFirTransformer( // CoroutineScope? -> this as? CoroutineScope // CoroutineScope -> this or throw error // CoroutineScope (optional) -> this or ignore - // TODO Any -> this - // TODO 后面的所有参数处理 - -// val listIterator = valueParameterSymbols.listIterator(1) -// listIterator.forEach { otherParameter -> -// -// } - - val secondParameter = valueParameterSymbols[1] - - val secondParameterType = secondParameter.resolvedReturnType - val secondParameterTypeNotNullable = - secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) + // Any -> this + // index 1 以及后面的所有参数都进行处理 fun ConeKotlinType.isCoroutineScope(): Boolean { return isSubtypeOf( @@ -456,74 +445,79 @@ class SuspendTransformFirTransformer( ) } - val isCoroutineScope = secondParameterTypeNotNullable.isCoroutineScope() - - if (isCoroutineScope) { - if (secondParameterType.isMarkedNullable) { - // this as? CoroutineScope - val secondParameterTypeNotNullable = - secondParameterType.makeConeTypeDefinitelyNotNullOrNotNull( - session.typeContext - ) - - put( - buildTypeOperatorCall { - source = originFunSymbol.source - coneTypeOrNull = secondParameterTypeNotNullable - argumentList = buildResolvedArgumentList( - null, - mapping = linkedMapOf().apply { - put( - buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType - source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } - }, - secondParameter.fir - ) - } - ) - operation = FirOperation.SAFE_AS - conversionTypeRef = - secondParameterTypeNotNullable.toFirResolvedTypeRef() - }, - secondParameter.fir - ) + fun thisReceiverExpression(): FirThisReceiverExpression { + return buildThisReceiverExpression { + coneTypeOrNull = + originFunSymbol.dispatchReceiverType + source = originFunSymbol.source + calleeReference = buildImplicitThisReference { + boundSymbol = owner + } + } + } - } else { - // if this is CoroutineScope, put, or throw error? + val listIterator = valueParameterSymbols.listIterator(1) + listIterator.forEach { parameterSymbol -> + val parameterFir = parameterSymbol.fir + val parameterType = parameterSymbol.resolvedReturnType - var ownerIsCoroutineScopeOrParameterIsOptional = secondParameter.hasDefaultValue + val parameterTypeNotNullable = if (parameterType.isMarkedNullable) { + parameterType.makeConeTypeDefinitelyNotNullOrNotNull(session.typeContext) + } else { + parameterType + } - for (superType in owner.getSuperTypes(session, recursive = false)) { - if (superType.isCoroutineScope()) { + when { + // 参数是 CoroutineScope(?) 类型 + parameterTypeNotNullable.isCoroutineScope() -> { + if (parameterType.isMarkedNullable) { + // scope = this as? CoroutineScope put( - buildThisReceiverExpression { - coneTypeOrNull = originFunSymbol.dispatchReceiverType + buildTypeOperatorCall { source = originFunSymbol.source - calleeReference = buildImplicitThisReference { - boundSymbol = owner - } + coneTypeOrNull = parameterTypeNotNullable + argumentList = buildResolvedArgumentList( + null, + mapping = linkedMapOf().apply { + put(thisReceiverExpression(), parameterFir) + } + ) + operation = FirOperation.SAFE_AS + conversionTypeRef = parameterTypeNotNullable.toFirResolvedTypeRef() }, - secondParameter.fir + parameterFir ) - ownerIsCoroutineScopeOrParameterIsOptional = true - break + } else { + // coroutine not nullable + // put if this is `CoroutineScope` or it is optional, otherwise throw error + var ownerIsCoroutineScopeOrParameterIsOptional = parameterSymbol.hasDefaultValue + for (superType in owner.getSuperTypes(session, recursive = false)) { + if (superType.isCoroutineScope()) { + put(thisReceiverExpression(), parameterFir) + ownerIsCoroutineScopeOrParameterIsOptional = true + break + } + } + + // or throw error? + if (!ownerIsCoroutineScopeOrParameterIsOptional) { + error( + "Owner is not a CoroutineScope, " + + "and the transformer function requires a `CoroutineScope` parameter." + ) + } } } - // or throw error? - if (!ownerIsCoroutineScopeOrParameterIsOptional) { - error( - "Owner is not a CoroutineScope, " + - "and the transformer function requires a `CoroutineScope` parameter." - ) + // 参数是 Any(?) 类型 + parameterTypeNotNullable == session.builtinTypes.anyType.coneType -> { + // 直接把 this 放进去,不需要转换 + put(thisReceiverExpression(), parameterFir) } } - } + + } }