From c8f310f710eda96831bd42755aec37869ccb8f11 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Thu, 14 Nov 2024 17:29:08 +0800 Subject: [PATCH] FIX the fk type parameter! ... maybe? --- buildSrc/src/main/kotlin/IProject.kt | 2 +- .../fir/SuspendTransformFirTransformer.kt | 287 ++++++++++++------ .../codegen/implOverridenGeneric.asm.txt | 2 - .../codegen/implOverridenGeneric.fir.ir.txt | 34 +-- .../src/testData/codegen/typeAttr.fir.ir.txt | 34 +-- gradle/libs.versions.toml | 2 +- 6 files changed, 223 insertions(+), 138 deletions(-) diff --git a/buildSrc/src/main/kotlin/IProject.kt b/buildSrc/src/main/kotlin/IProject.kt index d365c9e..5d2c625 100644 --- a/buildSrc/src/main/kotlin/IProject.kt +++ b/buildSrc/src/main/kotlin/IProject.kt @@ -10,7 +10,7 @@ object IProject : ProjectDetail() { const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin" // Remember the libs.versions.toml! - val ktVersion = "2.0.21" + val ktVersion = "2.0.20" val pluginVersion = "0.9.4" override val version: String = "$ktVersion-$pluginVersion" 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 17591c3..287ea4e 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 @@ -55,6 +55,10 @@ import org.jetbrains.kotlin.platform.konan.isNative import org.jetbrains.kotlin.types.ConstantValueKind import java.util.concurrent.ConcurrentHashMap +private data class CopiedTypeParameterPair( + val original: FirTypeParameter, + val copied: FirTypeParameter +) /** * @@ -150,114 +154,55 @@ class SuspendTransformFirTransformer( // 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? - val originalTypeParameterCache = mutableMapOf() - typeParameters.replaceAll { - buildTypeParameterCopy(it) { - containingDeclarationSymbol = newFunSymbol // it.containingDeclarationSymbol + val originalTypeParameterCache = mutableListOf() + typeParameters.replaceAll { + buildTypeParameterCopy(it) { + containingDeclarationSymbol = newFunSymbol // it.containingDeclarationSymbol // symbol = it.symbol // FirTypeParameterSymbol() - symbol = FirTypeParameterSymbol() - }.also { new -> - originalTypeParameterCache[it] = new - - } - } + symbol = FirTypeParameterSymbol() + }.also { new -> + originalTypeParameterCache.add(CopiedTypeParameterPair(it, new)) + } + } - // TODO valueParameters.replaceAll { vp -> buildValueParameterCopy(vp) { symbol = FirValueParameterSymbol(vp.symbol.name) - val cachedTypeParameter = originalTypeParameterCache.entries.find { (k, v) -> - k.toConeType() == vp.returnTypeRef.coneTypeOrNull - } - val newReturnTypeRef = if (cachedTypeParameter != null) { - returnTypeRef.withReplacedConeType(cachedTypeParameter.value.toConeType()) - } else { - println("returnTypeRef: $returnTypeRef") - returnTypeRef.coneType.typeArguments.forEach { - println("returnTypeRef.coneType.typeArguments: $it") - } + val copiedConeType = vp.returnTypeRef.coneTypeOrNull + ?.copyWithTypeParameters(originalTypeParameterCache) - returnTypeRef + if (copiedConeType != null) { + returnTypeRef = returnTypeRef.withReplacedConeType(copiedConeType) } - - returnTypeRef = newReturnTypeRef } } -// valueParameters.replaceAll { vp -> -// buildValueParameterCopy(vp) { -// //println("find: ${originalTypeParameterCache[vp.returnTypeRef]}") -// val cachedTypeParameter = originalTypeParameterCache.entries.find { (k, v) -> -// k.toConeType() == vp.returnTypeRef.coneTypeOrNull -// } -// println("cache conetype: $cachedTypeParameter") -// -// println("returnTypeRef1: $returnTypeRef") -// -// val stack = ArrayDeque() -// -// fun resolveTypeCopy() { -// -// } -// -// val type = returnTypeRef.coneTypeOrNull -// if (type != null && type.typeArguments.isNotEmpty()) { -// for (subArguments in type.typeArguments) { -// -// } -// } -// -// returnTypeRef.accept(object : FirVisitorVoid() { -// override fun visitElement(element: FirElement) { -// println("visitElement($element)") -// element.acceptChildren(this) -// } -// -// override fun visitResolvedTypeRef(resolvedTypeRef: FirResolvedTypeRef) { -// println("visitResolvedTypeRef(${resolvedTypeRef})") -// resolvedTypeRef.type.typeArguments.forEach { -// it.type?.typeArguments -// } -// super.visitResolvedTypeRef(resolvedTypeRef) -// } -// -// override fun visitValueParameter(valueParameter: FirValueParameter) { -// println("visitValueParameter($valueParameter)") -// super.visitValueParameter(valueParameter) -// } -// -// override fun visitTypeParameter(typeParameter: FirTypeParameter) { -// println("visitTypeParameter($typeParameter)") -// super.visitTypeParameter(typeParameter) -// } -// -// override fun visitTypeParameterRef(typeParameterRef: FirTypeParameterRef) { -// println("visitTypeParameterRef($typeParameterRef)") -// super.visitTypeParameterRef(typeParameterRef) -// } -// }) -// -// if (cachedTypeParameter != null) { -// returnTypeRef = returnTypeRef.withReplacedConeType(cachedTypeParameter.value.toConeType()) -// } -// -// println("returnTypeRef2: $returnTypeRef") -// symbol = FirValueParameterSymbol(vp.symbol.name) -// } -// } + receiverParameter?.also { receiverParameter -> + receiverParameter.typeRef.coneTypeOrNull + ?.copyWithTypeParameters(originalTypeParameterCache) + ?.also { foundCopied -> + this.receiverParameter = buildReceiverParameterCopy(receiverParameter) { + typeRef = typeRef.withReplacedConeType(foundCopied) + } + } + } - // valueParameters.replaceAll { vp -> - // buildValueParameterCopy(vp) { - // containingFunctionSymbol = newFunSymbol - // } - // } + + val coneTypeOrNull = returnTypeRef.coneTypeOrNull + if (coneTypeOrNull != null) { + returnTypeRef = returnTypeRef.withReplacedConeType( + coneTypeOrNull + .copyWithTypeParameters(originalTypeParameterCache) + ?: coneTypeOrNull, + ) + } annotations.clear() annotations.addAll(functionAnnotations) body = null - val returnType = resolveReturnType(originFunc, funData) + val returnType = resolveReturnType(originFunc, funData, returnTypeRef) returnTypeRef = returnType @@ -343,7 +288,8 @@ class SuspendTransformFirTransformer( ) ) - val returnType = resolveReturnType(original, funData) + + val returnType = resolveReturnType(original, funData, original.returnTypeRef) val p1 = buildProperty { symbol = pSymbol @@ -589,8 +535,12 @@ class SuspendTransformFirTransformer( session )?.firstOrNull() - private fun resolveReturnType(original: FirSimpleFunction, funData: FunData): FirTypeRef { - val resultConeType = resolveReturnConeType(original, funData) + private fun resolveReturnType( + original: FirSimpleFunction, + funData: FunData, + returnTypeRef: FirTypeRef + ): FirTypeRef { + val resultConeType = resolveReturnConeType(original, funData, returnTypeRef) return if (resultConeType is ConeErrorType) { buildErrorTypeRef { @@ -604,15 +554,19 @@ class SuspendTransformFirTransformer( } } - private fun resolveReturnConeType(original: FirSimpleFunction, funData: FunData): ConeKotlinType { + private fun resolveReturnConeType( + original: FirSimpleFunction, + funData: FunData, + returnTypeRef: FirTypeRef + ): ConeKotlinType { val transformer = funData.transformer val returnType = transformer.transformReturnType - ?: return original.symbol.resolvedReturnType + ?: return returnTypeRef.coneType // OrNull // original.symbol.resolvedReturnType var typeArguments: Array = emptyArray() if (transformer.transformReturnTypeGeneric) { - typeArguments = arrayOf(ConeKotlinTypeProjectionOut(original.returnTypeRef.coneType)) + typeArguments = arrayOf(ConeKotlinTypeProjectionOut(returnTypeRef.coneType)) } val resultConeType = returnType.toClassId().createConeType( @@ -892,6 +846,144 @@ class SuspendTransformFirTransformer( private infix fun FirTypeRef?.notSameAs(otherSuper: FirTypeRef?): Boolean = !(this sameAs otherSuper) + + private fun ConeKotlinType.copyWithTypeParameters( + parameters: List, + ): ConeKotlinType? { + fun findCopied(target: ConeKotlinType) = parameters.find { (original, _) -> + original.toConeType() == target + }?.copied + + when (this) { + is ConeDynamicType -> { + //println("Dynamic type: $this") + } + + is ConeFlexibleType -> { + //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? { + return when (projection) { + // is ConeFlexibleType -> { + // } + is ConeCapturedType -> { + val lowerType = projection.lowerType?.let { lowerType -> + findCopied(lowerType) + }?.toConeType() + + if (lowerType == null) { + projection.copy( + lowerType = lowerType + ) + } else { + null + } + } + + is ConeDefinitelyNotNullType -> { + findCopied(projection.original) + ?.toConeType() + ?.let { projection.copy(it) } + } + // is ConeIntegerConstantOperatorType -> TODO() + // is ConeIntegerLiteralConstantType -> TODO() + is ConeIntersectionType -> { + val upperBoundForApproximation = + projection.upperBoundForApproximation + ?.let { findCopied(it) } + ?.toConeType() + + var anyIntersectedTypes = false + + val intersectedTypes = projection.intersectedTypes.map { ktype -> + findCopied(ktype) + ?.toConeType() + ?.also { anyIntersectedTypes = true } + ?: ktype + } + + if (upperBoundForApproximation != null || anyIntersectedTypes) { + ConeIntersectionType( + intersectedTypes, + upperBoundForApproximation + ) + } else { + null + } + } + // is ConeLookupTagBasedType -> TODO() + // is ConeStubTypeForTypeVariableInSubtyping -> TODO() + // is ConeTypeVariableType -> { + // TODO() + // } + is ConeKotlinTypeConflictingProjection -> { + findCopied(projection.type) + ?.toConeType() + ?.let { projection.copy(it) } + } + + is ConeKotlinTypeProjectionIn -> { + findCopied(projection.type) + ?.toConeType() + ?.let { projection.copy(it) } + } + + is ConeKotlinTypeProjectionOut -> { + findCopied(projection.type) + ?.toConeType() + ?.let { projection.copy(it) } + } + + is ConeTypeParameterType -> { + findCopied(projection)?.toConeType() + } + + ConeStarProjection -> projection + // Other unknowns + else -> null + } + } + + val typeArguments: Array = typeArguments.map { projection -> + mapProjection(projection) ?: projection + }.toTypedArray() + + return classId?.createConeType( + session = session, + typeArguments = typeArguments, + nullable = isNullable + ) + // typeArguments.forEach { projection -> + // projection.type?.copyWithTypeParameters(parameters) + // } + } + + return null + } + + is ConeTypeParameterType -> { + return parameters.find { (original, _) -> + original.toConeType() == this + }?.copied?.toConeType() ?: this + } + + else -> { + + } + } + return this + // this.fullyExpandedClassId().createConeType() + } } @@ -912,3 +1004,4 @@ private val FirSimpleFunction.syntheticModifier: Modality? modality == Modality.ABSTRACT -> Modality.OPEN else -> status.modality } + diff --git a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.asm.txt b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.asm.txt index 9ed915d..2429b42 100644 --- a/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.asm.txt +++ b/compiler/suspend-transform-plugin/src/testData/codegen/implOverridenGeneric.asm.txt @@ -293,8 +293,6 @@ public final class FooInterface3Impl : java/lang/Object, FooInterface3 { public Bar data2Blocking(java.lang.Object value) - 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) 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 bd101fd..76ed5eb 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,14 +19,14 @@ 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.data2) returnType:T of .FooInterface1Impl + 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.data2 + 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.data2): T of .FooInterface1Impl declared in .FooInterface1Impl' + 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 @@ -36,7 +36,7 @@ FILE fqName: fileName:/Main.kt 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.data2 declared in .FooInterface1Impl.data2Blocking' type=A of .FooInterface1Impl.data2 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 @@ -205,14 +205,6 @@ FILE fqName: fileName:/Main.kt 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:data2Blocking visibility:public modality:OPEN ($this:.FooInterface3.FooInterface3Impl>, value:A of .FooInterface3.data2) returnType:T of .FooInterface3Impl [fake_override] - annotations: - Api4J - overridden: - public open fun data2Blocking (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:.FooInterface3.FooInterface3Impl> - VALUE_PARAMETER name:value index:0 type:A of .FooInterface3.data2 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 @@ -226,14 +218,16 @@ 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.data2) returnType:T of .FooInterface3Impl + 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.data2 + 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.data2): T of .FooInterface3Impl declared in .FooInterface3Impl' + 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 @@ -243,7 +237,7 @@ FILE fqName: fileName:/Main.kt 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.data2 declared in .FooInterface3Impl.data2Blocking' type=A of .FooInterface3Impl.data2 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 @@ -510,14 +504,14 @@ 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.data2) returnType:T of .FooInterface3 + 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.data2 + 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.data2): T of .FooInterface3 declared in .FooInterface3' + 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 @@ -527,7 +521,7 @@ FILE fqName: fileName:/Main.kt 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.data2 declared in .FooInterface3.data2Blocking' type=A of .FooInterface3.data2 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 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 7ea9238..4b096d5 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 @@ -53,22 +53,22 @@ FILE fqName: fileName:/Main.kt 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.Foo.run>) returnType:java.util.concurrent.CompletableFuture [fake_override] + 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.run>): java.util.concurrent.CompletableFuture declared in .Foo + 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.Foo.run> - FUN FAKE_OVERRIDE name:runBlocking visibility:public modality:OPEN ($this:.Foo<.Tar>, api:.Api.Foo.run>) returnType:R of .Foo.run [fake_override] + 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.run>): R of .Foo.run declared in .Foo + 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.Foo.run> + 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 @@ -136,14 +136,14 @@ 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.run>) returnType:java.util.concurrent.CompletableFuture + 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.run> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runAsync> BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun runAsync (api: .Api.Foo.run>): java.util.concurrent.CompletableFuture declared in .Foo' + 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 @@ -153,25 +153,25 @@ FILE fqName: fileName:/Main.kt 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.run> declared in .Foo.runAsync' type=.Api.Foo.run> origin=null - FUN GENERATED[love.forte.plugin.suspendtrans.fir.SuspendTransformPluginKey] name:runBlocking visibility:public modality:OPEN ($this:.Foo.Foo>, api:.Api.Foo.run>) returnType:R of .Foo.run + 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.run> + VALUE_PARAMETER name:api index:0 type:.Api.Foo.runBlocking> BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun runBlocking (api: .Api.Foo.run>): R of .Foo.run declared in .Foo' + 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.run> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> () returnType:R of .Foo.run [suspend] + 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.run declared in .Foo.runBlocking' + 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.run> declared in .Foo.runBlocking' type=.Api.Foo.run> 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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5a32ef8..c75553d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ kotlinx-coroutines = "1.8.0" kotlinx-serialization = "1.7.1" google-auto-service = "1.0.1" # Remember the `IProject.ktVersion`! -kotlin = "2.0.21" +kotlin = "2.0.20" [libraries]