Skip to content

Commit 6857e30

Browse files
bnormdemiurg906
authored andcommitted
Upgrade Kotlin to version 2.1.20
1 parent 5a260d3 commit 6857e30

File tree

9 files changed

+169
-131
lines changed

9 files changed

+169
-131
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
2-
kotlin("multiplatform") version "2.0.0" apply false
3-
kotlin("jvm") version "2.0.0" apply false
2+
kotlin("multiplatform") version "2.1.20" apply false
3+
kotlin("jvm") version "2.1.20" apply false
44
id("com.github.gmazzo.buildconfig") version "5.6.5"
55
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.16.3" apply false
66
}

compiler-plugin/src/org/demiurg906/kotlin/plugin/fir/SimpleClassGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class SimpleClassGenerator(session: FirSession) : FirDeclarationGenerationExtens
4747
context: MemberGenerationContext?
4848
): List<FirNamedFunctionSymbol> {
4949
val owner = context?.owner ?: return emptyList()
50-
val function = createMemberFunction(owner, Key, callableId.callableName, returnType = session.builtinTypes.stringType.type)
50+
val function = createMemberFunction(owner, Key, callableId.callableName, returnType = session.builtinTypes.stringType.coneType)
5151
return listOf(function.symbol)
5252
}
5353

compiler-plugin/src/org/demiurg906/kotlin/plugin/ir/AbstractTransformerForGenerator.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ abstract class AbstractTransformerForGenerator(protected val context: IrPluginCo
6464
constructor.symbol,
6565
typeArgumentsCount = 0,
6666
constructorTypeArgumentsCount = 0,
67-
valueArgumentsCount = 0
6867
)
6968
val returnStatement = IrReturnImpl(-1, -1, irBuiltIns.nothingType, function.symbol, constructorCall)
7069
return irFactory.createBlockBody(-1, -1, listOf(returnStatement))
@@ -79,7 +78,6 @@ abstract class AbstractTransformerForGenerator(protected val context: IrPluginCo
7978
irBuiltIns.anyType,
8079
irBuiltIns.anyClass.owner.primaryConstructor?.symbol ?: return null,
8180
typeArgumentsCount = 0,
82-
valueArgumentsCount = 0
8381
)
8482

8583
val initializerCall = IrInstanceInitializerCallImpl(

compiler-plugin/test-fixtures/org/demiurg906/kotlin/plugin/runners/AbstractBoxTest.kt

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,34 @@ open class AbstractBoxTest : BaseTestRunner(), RunnerWithTargetBackendForTestGen
3030
override val targetBackend: TargetBackend
3131
get() = TargetBackend.JVM_IR
3232

33-
override fun TestConfigurationBuilder.configuration() {
34-
globalDefaults {
35-
targetBackend = TargetBackend.JVM_IR
36-
targetPlatform = JvmPlatforms.defaultJvmPlatform
37-
dependencyKind = DependencyKind.Binary
38-
}
33+
override fun configure(builder: TestConfigurationBuilder) {
34+
with(builder) {
35+
globalDefaults {
36+
targetBackend = TargetBackend.JVM_IR
37+
targetPlatform = JvmPlatforms.defaultJvmPlatform
38+
dependencyKind = DependencyKind.Binary
39+
}
3940

40-
configureFirParser(FirParser.Psi)
41+
configureFirParser(FirParser.Psi)
4142

42-
defaultDirectives {
43-
+DUMP_IR
44-
}
43+
defaultDirectives {
44+
+DUMP_IR
45+
}
4546

46-
commonFirWithPluginFrontendConfiguration()
47-
fir2IrStep()
48-
irHandlersStep {
49-
useHandlers(
50-
::IrTextDumpHandler,
51-
::IrTreeVerifierHandler,
52-
)
53-
}
54-
facadeStep(::JvmIrBackendFacade)
55-
jvmArtifactsHandlersStep {
56-
useHandlers(::JvmBoxRunner)
57-
}
47+
commonFirWithPluginFrontendConfiguration()
48+
fir2IrStep()
49+
irHandlersStep {
50+
useHandlers(
51+
::IrTextDumpHandler,
52+
::IrTreeVerifierHandler,
53+
)
54+
}
55+
facadeStep(::JvmIrBackendFacade)
56+
jvmArtifactsHandlersStep {
57+
useHandlers(::JvmBoxRunner)
58+
}
5859

59-
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
60+
useAfterAnalysisCheckers(::BlackBoxCodegenSuppressor)
61+
}
6062
}
6163
}

compiler-plugin/test-fixtures/org/demiurg906/kotlin/plugin/runners/AbstractDiagnosticTest.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@ package org.demiurg906.kotlin.plugin.runners
22

33
import org.jetbrains.kotlin.test.FirParser
44
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
5-
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives.WITH_STDLIB
6-
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives.FIR_DUMP
75
import org.jetbrains.kotlin.test.directives.configureFirParser
8-
import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
96
import org.jetbrains.kotlin.test.services.EnvironmentBasedStandardLibrariesPathProvider
107
import org.jetbrains.kotlin.test.services.KotlinStandardLibrariesPathProvider
118

129
abstract class AbstractDiagnosticTest : BaseTestRunner() {
13-
override fun TestConfigurationBuilder.configuration() {
14-
commonFirWithPluginFrontendConfiguration()
15-
configureFirParser(FirParser.Psi)
10+
override fun configure(builder: TestConfigurationBuilder) {
11+
with(builder) {
12+
commonFirWithPluginFrontendConfiguration()
13+
configureFirParser(FirParser.Psi)
14+
}
1615
}
1716

1817
override fun createKotlinStandardLibrariesPathProvider(): KotlinStandardLibrariesPathProvider {

compiler-plugin/test-fixtures/org/demiurg906/kotlin/plugin/runners/BaseTestRunner.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package org.demiurg906.kotlin.plugin.runners
22

3+
import org.demiurg906.kotlin.plugin.services.ExtensionRegistrarConfigurator
4+
import org.demiurg906.kotlin.plugin.services.PluginAnnotationsProvider
35
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
4-
import org.jetbrains.kotlin.test.directives.ConfigurationDirectives
6+
import org.jetbrains.kotlin.test.configuration.baseFirDiagnosticTestConfiguration
57
import org.jetbrains.kotlin.test.directives.FirDiagnosticsDirectives
8+
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
69
import org.jetbrains.kotlin.test.initIdeaConfiguration
710
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerTest
8-
import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration
911
import org.jetbrains.kotlin.test.services.EnvironmentBasedStandardLibrariesPathProvider
1012
import org.jetbrains.kotlin.test.services.KotlinStandardLibrariesPathProvider
1113
import org.junit.jupiter.api.BeforeAll
12-
import org.demiurg906.kotlin.plugin.services.ExtensionRegistrarConfigurator
13-
import org.demiurg906.kotlin.plugin.services.PluginAnnotationsProvider
14-
import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives
1514

1615
abstract class BaseTestRunner : AbstractKotlinCompilerTest() {
1716
companion object {

compiler-plugin/testData/box/anotherBoxTest.fir.ir.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,28 @@ FILE fqName:<root> fileName:/anotherBoxTest.kt
3333
then: STRING_CONCATENATION type=kotlin.String
3434
CONST String type=kotlin.String value="Fail: "
3535
GET_VAR 'val result: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
36+
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
37+
CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
38+
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.MyClass
39+
CONSTRUCTOR GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
40+
BLOCK_BODY
41+
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
42+
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
43+
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
44+
overridden:
45+
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
46+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
47+
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
48+
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
49+
overridden:
50+
public open fun hashCode (): kotlin.Int declared in kotlin.Any
51+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
52+
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
53+
overridden:
54+
public open fun toString (): kotlin.String declared in kotlin.Any
55+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
56+
FUN GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
57+
$this: VALUE_PARAMETER name:<this> type:foo.bar.MyClass
58+
BLOCK_BODY
59+
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in foo.bar.MyClass'
60+
CONST String type=kotlin.String value="Hello world"

compiler-plugin/testData/box/simple.fir.ir.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,28 @@ FILE fqName:foo.bar fileName:/simple.kt
1818
STRING_CONCATENATION type=kotlin.String
1919
CONST String type=kotlin.String value="Fail: "
2020
GET_VAR 'val result: kotlin.String declared in foo.bar.box' type=kotlin.String origin=null
21+
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
22+
CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
23+
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.MyClass
24+
CONSTRUCTOR GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
25+
BLOCK_BODY
26+
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
27+
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
28+
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
29+
overridden:
30+
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
31+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
32+
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
33+
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
34+
overridden:
35+
public open fun hashCode (): kotlin.Int declared in kotlin.Any
36+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
37+
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
38+
overridden:
39+
public open fun toString (): kotlin.String declared in kotlin.Any
40+
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
41+
FUN GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
42+
$this: VALUE_PARAMETER name:<this> type:foo.bar.MyClass
43+
BLOCK_BODY
44+
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in foo.bar.MyClass'
45+
CONST String type=kotlin.String value="Hello world"

0 commit comments

Comments
 (0)