Skip to content

Commit 19b8740

Browse files
committed
Merge branch 'kt-22-20' into dev
# Conflicts: # buildSrc/src/main/kotlin/IProject.kt # gradle/libs.versions.toml # kotlin-js-store/wasm/yarn.lock # kotlin-js-store/yarn.lock
2 parents ebad6bf + bd19577 commit 19b8740

File tree

9 files changed

+199
-2385
lines changed

9 files changed

+199
-2385
lines changed

.changelog/v2.2.20-Beta1-0.13.1.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Kotlin version: `v2.2.20-Beta1`

buildSrc/src/main/kotlin/IProject.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ object IProject : ProjectDetail() {
1010
const val HOMEPAGE = "https://github.com/ForteScarlet/kotlin-suspend-transform-compiler-plugin"
1111

1212
// Remember the libs.versions.toml!
13-
val ktVersion = "2.2.10"
13+
val ktVersion = "2.2.20-Beta1"
1414
val pluginVersion = "0.13.1"
1515

1616
override val version: String = "$ktVersion-$pluginVersion"

compiler/suspend-transform-plugin/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ kotlin {
5656
)
5757
freeCompilerArgs.addAll(
5858
"-Xjvm-default=all",
59-
// "-opt-in=kotlin.RequiresOptIn",
60-
// "-opt-in=org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI",
59+
"-Xcontext-parameters"
6160
)
6261
}
6362
}

compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ class SuspendTransformFirTransformer(
348348
newFunTarget: FirFunctionTarget,
349349
transformer: Transformer
350350
): FirBlock = buildBlock {
351-
this.source = originFunc.body?.source
352-
351+
this.source = originFunSymbol.bodySource ?: originFunSymbol.source
353352
// lambda: suspend () -> T
354353
val lambdaTarget = FirFunctionTarget(null, isLambda = true)
355354
val lambda = buildAnonymousFunction {
355+
this.source = originFunSymbol.bodySource ?: originFunSymbol.source
356356
this.resolvePhase = FirResolvePhase.BODY_RESOLVE
357357
// this.resolvePhase = FirResolvePhase.RAW_FIR
358358
this.isLambda = true
@@ -837,51 +837,50 @@ class SuspendTransformFirTransformer(
837837
val markAnnotation = syntheticFunData.transformer.markAnnotation
838838

839839
if (func.isOverride && !isOverride) {
840-
// func.processOverriddenFunctionsSafe()
841-
func.processOverriddenFunctionsSafe(
842-
checkContext
843-
) processOverridden@{ overriddenFunction ->
844-
if (!isOverride) {
845-
// check parameters and receivers
846-
val resolvedReceiverTypeRef = overriddenFunction.resolvedReceiverTypeRef
847-
val originReceiverTypeRef = func.resolvedReceiverTypeRef
848-
849-
// origin receiver should be the same as symbol receiver
850-
if (originReceiverTypeRef != resolvedReceiverTypeRef) {
851-
return@processOverridden
852-
}
840+
with(checkContext) {
841+
func.processOverriddenFunctionsSafe processOverridden@{ overriddenFunction ->
842+
if (!isOverride) {
843+
// check parameters and receivers
844+
val resolvedReceiverTypeRef = overriddenFunction.resolvedReceiverTypeRef
845+
val originReceiverTypeRef = func.resolvedReceiverTypeRef
846+
847+
// origin receiver should be the same as symbol receiver
848+
if (originReceiverTypeRef != resolvedReceiverTypeRef) {
849+
return@processOverridden
850+
}
853851

854-
// all value parameters should be a subtype of symbol's value parameters
855-
val symbolParameterSymbols = overriddenFunction.valueParameterSymbols
856-
val originParameterSymbols = func.valueParameterSymbols
852+
// all value parameters should be a subtype of symbol's value parameters
853+
val symbolParameterSymbols = overriddenFunction.valueParameterSymbols
854+
val originParameterSymbols = func.valueParameterSymbols
857855

858-
if (symbolParameterSymbols.size != originParameterSymbols.size) {
859-
return@processOverridden
860-
}
861-
862-
for ((index, symbolParameter) in symbolParameterSymbols.withIndex()) {
863-
val originParameter = originParameterSymbols[index]
864-
if (
865-
originParameter.resolvedReturnType != symbolParameter.resolvedReturnType
866-
) {
856+
if (symbolParameterSymbols.size != originParameterSymbols.size) {
867857
return@processOverridden
868858
}
869-
}
870859

871-
val overriddenAnnotation = firAnnotation(
872-
overriddenFunction, markAnnotation, overriddenFunction.getContainingClassSymbol()
873-
) ?: return@processOverridden
860+
for ((index, symbolParameter) in symbolParameterSymbols.withIndex()) {
861+
val originParameter = originParameterSymbols[index]
862+
if (
863+
originParameter.resolvedReturnType != symbolParameter.resolvedReturnType
864+
) {
865+
return@processOverridden
866+
}
867+
}
874868

875-
val overriddenAnnoData = overriddenAnnotation.toTransformAnnotationData(
876-
markAnnotation, overriddenFunction.name.asString()
877-
)
869+
val overriddenAnnotation = firAnnotation(
870+
overriddenFunction, markAnnotation, overriddenFunction.getContainingClassSymbol()
871+
) ?: return@processOverridden
872+
873+
val overriddenAnnoData = overriddenAnnotation.toTransformAnnotationData(
874+
markAnnotation, overriddenFunction.name.asString()
875+
)
878876

879-
// Same functionName, same asProperty, the generated synthetic function will be same too.
880-
if (
881-
overriddenAnnoData.functionName == annoData.functionName
882-
&& overriddenAnnoData.asProperty == annoData.asProperty
883-
) {
884-
isOverride = true
877+
// Same functionName, same asProperty, the generated synthetic function will be same too.
878+
if (
879+
overriddenAnnoData.functionName == annoData.functionName
880+
&& overriddenAnnoData.asProperty == annoData.asProperty
881+
) {
882+
isOverride = true
883+
}
885884
}
886885
}
887886
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kotlinx-coroutines = "1.8.0"
33
kotlinx-serialization = "1.7.1"
44
google-auto-service = "1.0.1"
55
# Remember the `IProject.ktVersion`!
6-
kotlin = "2.2.10"
6+
kotlin = "2.2.20-Beta1"
77

88
# https://www.jetbrains.com/help/kotlin-multiplatform-dev/multiplatform-publish-libraries.html#configure-the-project
99
# https://github.com/vanniktech/gradle-maven-publish-plugin

0 commit comments

Comments
 (0)