Skip to content

Commit fe26ea1

Browse files
committed
Bump Kotlin to 2.2.0.
1 parent e6bf55c commit fe26ea1

File tree

7 files changed

+23
-20
lines changed

7 files changed

+23
-20
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
2-
kotlin("jvm") version "2.1.20" apply false
2+
kotlin("jvm") version "2.2.0" apply false
33
id("org.jetbrains.dokka") version "1.7.10" apply false
44
id("com.github.gmazzo.buildconfig") version "2.1.0" apply false
5-
id("com.vanniktech.maven.publish") version "0.22.0" apply false
5+
id("com.vanniktech.maven.publish") version "0.31.0" apply false
66
}
77

88
subprojects {

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
kotlin.code.style=official
22

3-
VERSION_NAME=2.1.20-1.1.0
3+
VERSION_NAME=2.2.0-1.1.0
44

55
GROUP=com.bennyhuo.kotlin
66

@@ -23,6 +23,6 @@ POM_DEVELOPER_URL=https://github.com/bennyhuo/
2323

2424
KOTLIN_PLUGIN_ID=com.bennyhuo.kotlin.trimindent
2525

26-
SONATYPE_HOST=S01
26+
SONATYPE_HOST=CENTRAL_PORTAL
2727
SONATYPE_AUTOMATIC_RELEASE=true
2828
RELEASE_SIGNING_ENABLED=true

sample/gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
kotlin = "2.1.21"
2+
kotlin = "2.2.0"
33

44
[libraries]
55

trimindent-compiler/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies {
1515
compileOnly("com.google.auto.service:auto-service-annotations:1.0.1")
1616

1717
testImplementation(kotlin("test-junit"))
18-
testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:2.1.0-1.3.0")
18+
testImplementation("com.bennyhuo.kotlin:kotlin-compile-testing-extensions:2.2.0-1.3.0")
1919
}
2020

2121
kotlin {

trimindent-compiler/src/main/java/com/bennyhuo/kotlin/trimindent/compiler/IrUtils.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import org.jetbrains.kotlin.name.FqName
1616
import org.jetbrains.kotlin.name.Name
1717
import kotlin.contracts.ExperimentalContracts
1818
import kotlin.contracts.contract
19+
import org.jetbrains.kotlin.DeprecatedForRemovalCompilerApi
20+
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
1921
import org.jetbrains.kotlin.name.CallableId
2022

2123
/**
@@ -31,15 +33,17 @@ fun IrStringConcatenation.copyWithNewValues(
3133
}
3234

3335
internal fun IrCall.isTrimIndent(): Boolean {
34-
return symbol.owner.name == Name.identifier("trimIndent")
35-
&& dispatchReceiver == null
36-
&& extensionReceiver?.type?.classFqName?.asString() == "kotlin.String"
37-
&& symbol.owner.getPackageFragment().packageFqName.asString() == "kotlin.text"
36+
return symbol.owner.let {
37+
it.name == Name.identifier("trimIndent")
38+
&& it.parameters.firstOrNull()?.type?.classFqName?.asString() == "kotlin.String"
39+
&& it.getPackageFragment().packageFqName.asString() == "kotlin.text"
40+
}
41+
3842
}
3943

4044
fun IrPluginContext.prependIndent(): IrFunction {
4145
return referenceFunctions(CallableId(FqName("kotlin.text"), Name.identifier("prependIndent")))
4246
.singleOrNull {
43-
it.owner.extensionReceiverParameter?.type?.classFqName?.asString() == "kotlin.String"
47+
it.owner.parameters.firstOrNull()?.type?.classFqName?.asString() == "kotlin.String"
4448
}?.owner!!
4549
}

trimindent-compiler/src/main/java/com/bennyhuo/kotlin/trimindent/compiler/String.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.bennyhuo.kotlin.trimindent.compiler
22

3+
import org.jetbrains.kotlin.DeprecatedForRemovalCompilerApi
34
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
45
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
56
import org.jetbrains.kotlin.ir.expressions.IrConst
@@ -44,14 +45,12 @@ class IrExpressionElement(val irExpression: IrExpression) : IrStringElement {
4445
preIndentFunction.symbol as IrSimpleFunctionSymbol,
4546
0
4647
).apply {
47-
extensionReceiver = irExpression
48-
putValueArgument(
49-
0, IrConstImpl.string(
50-
irExpression.startOffset,
51-
irExpression.endOffset,
52-
pluginContext.irBuiltIns.stringType,
53-
indent
54-
)
48+
arguments[0] = irExpression
49+
arguments[1] = IrConstImpl.string(
50+
irExpression.startOffset,
51+
irExpression.endOffset,
52+
pluginContext.irBuiltIns.stringType,
53+
indent
5554
)
5655
}
5756

trimindent-compiler/src/main/java/com/bennyhuo/kotlin/trimindent/compiler/TrimIndentIrGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TrimIndentIrGenerator : IrGenerationExtension {
1818
moduleFragment.transformChildrenVoid(object : IrElementTransformerVoid() {
1919
override fun visitCall(irCall: IrCall): IrExpression {
2020
if (irCall.isTrimIndent()) {
21-
val extensionReceiver = irCall.extensionReceiver!!
21+
val extensionReceiver = irCall.arguments.first()
2222
if (extensionReceiver is IrConst && extensionReceiver.kind == IrConstKind.String) {
2323
val value = extensionReceiver.value as String
2424
return super.visitExpression(extensionReceiver.copyWithNewValue(value.trimIndent()))

0 commit comments

Comments
 (0)