From a9418062b0ba07603a19a8bf66a85fd56a99f5ce Mon Sep 17 00:00:00 2001 From: Rafael Tonholo Date: Fri, 29 Nov 2024 13:01:27 -0400 Subject: [PATCH] Add compatibility with Kotlin 2.1.0 (#74) --- .../main/kotlin/app/cash/burst/kotlin/Argument.kt | 6 +++--- .../app/cash/burst/kotlin/ClassSpecializer.kt | 2 -- .../src/main/kotlin/app/cash/burst/kotlin/ir.kt | 3 +-- gradle/libs.versions.toml | 6 +++--- kotlin-js-store/yarn.lock | 15 +++++++++++---- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/Argument.kt b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/Argument.kt index 6dd21bd..6e24db1 100644 --- a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/Argument.kt +++ b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/Argument.kt @@ -188,7 +188,7 @@ private fun burstValuesArguments( @UnsafeDuringIrConstructionAPI private fun IrExpression.suggestedName(): String? { val raw = when (this) { - is IrConst<*> -> value.toString() + is IrConst -> value.toString() is IrCall -> { val target = (symbol.owner.correspondingPropertySymbol?.owner ?: symbol.owner) target.name.asString() @@ -214,7 +214,7 @@ private fun enumValueArguments( val expression = defaultValue.expression when { expression is IrGetEnumValue -> expression.symbol.owner.name - expression is IrConst<*> && expression.value == null -> null + expression is IrConst && expression.value == null -> null else -> unexpectedDefaultValue(parameter) } } @@ -249,7 +249,7 @@ private fun IrPluginContext.booleanArguments( val defaultValue = parameter.defaultValue?.let { defaultValue -> val expression = defaultValue.expression when { - expression is IrConst<*> -> expression.value + expression is IrConst -> expression.value else -> unexpectedDefaultValue(parameter) } } diff --git a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ClassSpecializer.kt b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ClassSpecializer.kt index cbd7655..7960878 100644 --- a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ClassSpecializer.kt +++ b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ClassSpecializer.kt @@ -143,7 +143,6 @@ internal class ClassSpecializer( statements += irDelegatingConstructorCall( context = pluginContext, symbol = superConstructor.symbol, - valueArgumentsCount = specialization.arguments.size, ) { for ((index, argument) in specialization.arguments.withIndex()) { putValueArgument(index, argument.expression()) @@ -172,7 +171,6 @@ internal class ClassSpecializer( statements += irDelegatingConstructorCall( context = pluginContext, symbol = superConstructor.symbol, - valueArgumentsCount = specialization.arguments.size, ) { for ((index, argument) in specialization.arguments.withIndex()) { putValueArgument(index, argument.expression()) diff --git a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ir.kt b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ir.kt index 2efa0b7..0276347 100644 --- a/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ir.kt +++ b/burst-kotlin-plugin/src/main/kotlin/app/cash/burst/kotlin/ir.kt @@ -43,6 +43,7 @@ import org.jetbrains.kotlin.ir.expressions.IrInstanceInitializerCall import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrDelegatingConstructorCallImpl import org.jetbrains.kotlin.ir.expressions.impl.IrInstanceInitializerCallImpl +import org.jetbrains.kotlin.ir.expressions.impl.fromSymbolOwner import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol @@ -141,7 +142,6 @@ fun DeclarationIrBuilder.irDelegatingConstructorCall( context: IrGeneratorContext, symbol: IrConstructorSymbol, typeArgumentsCount: Int = 0, - valueArgumentsCount: Int = 0, block: IrDelegatingConstructorCall.() -> Unit = {}, ): IrDelegatingConstructorCall { val result = IrDelegatingConstructorCallImpl( @@ -150,7 +150,6 @@ fun DeclarationIrBuilder.irDelegatingConstructorCall( type = context.irBuiltIns.unitType, symbol = symbol, typeArgumentsCount = typeArgumentsCount, - valueArgumentsCount = valueArgumentsCount, ) result.block() return result diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 63453be..eadb06c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -kotlin = "2.0.21" +kotlin = "2.1.0" [libraries] android-gradlePlugin = "com.android.tools.build:gradle:8.7.2" @@ -8,10 +8,10 @@ auto-service-annotations = { module = "com.google.auto.service:auto-service-anno auto-service-compiler = { module = "dev.zacsweers.autoservice:auto-service-ksp", version = "1.2.0" } binary-compatibility-validator-gradle-plugin = { module = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version = "0.16.3" } dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" } -google-ksp = "com.google.devtools.ksp:symbol-processing-gradle-plugin:2.0.21-1.0.28" +google-ksp = "com.google.devtools.ksp:symbol-processing-gradle-plugin:2.1.0-1.0.29" junit = { module = "junit:junit", version = "4.13.2" } junit-vintage-engine = { module = "org.junit.vintage:junit-vintage-engine", version = "5.11.3" } -kotlin-compile-testing = { module = "dev.zacsweers.kctfork:core", version = "0.6.0" } +kotlin-compile-testing = { module = "dev.zacsweers.kctfork:core", version = "0.7.0" } kotlin-gradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" } mavenPublish-gradle-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.30.0" } diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 881fd5c..cb4b541 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -274,6 +274,13 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +kotlin-web-helpers@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286" + integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw== + dependencies: + format-util "^1.0.5" + locate-path@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" @@ -296,10 +303,10 @@ minimatch@^5.0.1, minimatch@^5.1.6: dependencies: brace-expansion "^2.0.1" -mocha@10.7.0: - version "10.7.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a" - integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA== +mocha@10.7.3: + version "10.7.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" + integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== dependencies: ansi-colors "^4.1.3" browser-stdout "^1.3.1"