Skip to content

Commit

Permalink
Add compatibility with Kotlin 2.1.0 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeltonholo authored Nov 29, 2024
1 parent 4bb758d commit a941806
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
}
}
Expand Down Expand Up @@ -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)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -141,7 +142,6 @@ fun DeclarationIrBuilder.irDelegatingConstructorCall(
context: IrGeneratorContext,
symbol: IrConstructorSymbol,
typeArgumentsCount: Int = 0,
valueArgumentsCount: Int = 0,
block: IrDelegatingConstructorCall.() -> Unit = {},
): IrDelegatingConstructorCall {
val result = IrDelegatingConstructorCallImpl(
Expand All @@ -150,7 +150,6 @@ fun DeclarationIrBuilder.irDelegatingConstructorCall(
type = context.irBuiltIns.unitType,
symbol = symbol,
typeArgumentsCount = typeArgumentsCount,
valueArgumentsCount = valueArgumentsCount,
)
result.block()
return result
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlin = "2.0.21"
kotlin = "2.1.0"

[libraries]
android-gradlePlugin = "com.android.tools.build:gradle:8.7.2"
Expand All @@ -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" }
Expand Down
15 changes: 11 additions & 4 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"

[email protected]:
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"
Expand All @@ -296,10 +303,10 @@ minimatch@^5.0.1, minimatch@^5.1.6:
dependencies:
brace-expansion "^2.0.1"

[email protected].0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
integrity sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==
[email protected].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"
Expand Down

0 comments on commit a941806

Please sign in to comment.