diff --git a/MODULE.bazel b/MODULE.bazel index 3e261fac8f6..b24546d4a3c 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -230,6 +230,7 @@ use_repo( "kotlin-compiler-2.1.20-Beta1", "kotlin-compiler-2.2.0-Beta1", "kotlin-compiler-2.2.20-Beta2", + "kotlin-compiler-2.3.0", "kotlin-compiler-embeddable-1.8.0", "kotlin-compiler-embeddable-1.9.0-Beta", "kotlin-compiler-embeddable-1.9.20-Beta", @@ -239,6 +240,7 @@ use_repo( "kotlin-compiler-embeddable-2.1.20-Beta1", "kotlin-compiler-embeddable-2.2.0-Beta1", "kotlin-compiler-embeddable-2.2.20-Beta2", + "kotlin-compiler-embeddable-2.3.0", "kotlin-stdlib-1.8.0", "kotlin-stdlib-1.9.0-Beta", "kotlin-stdlib-1.9.20-Beta", @@ -248,6 +250,7 @@ use_repo( "kotlin-stdlib-2.1.20-Beta1", "kotlin-stdlib-2.2.0-Beta1", "kotlin-stdlib-2.2.20-Beta2", + "kotlin-stdlib-2.3.0", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.3.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0.jar new file mode 100644 index 00000000000..58a4dfadbe9 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03e377b3beffa83e26674d0663f746bfb969b197fd8aed9432cfd8abd60db0c5 +size 59091069 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0.jar new file mode 100644 index 00000000000..00ec4cb6801 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8dbd882fa58c3d17e683a27390288315f8b490f8e3e3b1be4dc3e280d37e285a +size 57669576 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0.jar new file mode 100644 index 00000000000..5a668eba5f1 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:887587c91713250ad52fe14ad9166d042c33835049890e9437f355ffc5a195b1 +size 1796996 diff --git a/java/kotlin-extractor/dev/wrapper.py b/java/kotlin-extractor/dev/wrapper.py index aeef81e5c1d..7785c623f4f 100755 --- a/java/kotlin-extractor/dev/wrapper.py +++ b/java/kotlin-extractor/dev/wrapper.py @@ -27,7 +27,7 @@ import shutil import io import os -DEFAULT_VERSION = "2.2.0" +DEFAULT_VERSION = "2.3.0" def options(): diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index cb1ce8ed253..fc22eda04d4 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -1645,7 +1645,7 @@ open class KotlinFileExtractor( extractMethodAndParameterTypeAccesses: Boolean, typeSubstitution: TypeSubstitution?, classTypeArgsIncludingOuterClasses: List? - ) = + ) : Label = forceExtractFunction( f, parentId, @@ -2975,12 +2975,22 @@ open class KotlinFileExtractor( val locId = tw.getLocation(s) tw.writeStmts_block(blockId, parent, idx, callable) tw.writeHasLocation(blockId, locId) - extractVariable(s.delegate, callable, blockId, 0) + // For Kotlin < 2.3, s.deligate is not-nullable. Cast to a be nullable, + // as a workaround to silence warnings for kotlin < 2.3 about the elvis + // operator being redundant. + // For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning + + @Suppress("USELESS_CAST") + val delegate = (s.delegate as IrVariable?) ?: run { + logger.errorElement("Local delegated property is missing delegate", s) + return + } + extractVariable(delegate, callable, blockId, 0) val propId = tw.getFreshIdLabel() tw.writeKtProperties(propId, s.name.asString()) tw.writeHasLocation(propId, locId) - tw.writeKtPropertyDelegates(propId, useVariable(s.delegate)) + tw.writeKtPropertyDelegates(propId, useVariable(delegate)) // Getter: extractStatement(s.getter, callable, blockId, 1) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index bb664e711a3..ba38ac1da37 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -849,9 +849,6 @@ open class KotlinUsesExtractor( } private fun useSimpleType(s: IrSimpleType, context: TypeContext): TypeResults { - if (s.abbreviation != null) { - // TODO: Extract this information - } // We use this when we don't actually have an IrClass for a class // we want to refer to // TODO: Eliminate the need for this if possible diff --git a/java/kotlin-extractor/versions.bzl b/java/kotlin-extractor/versions.bzl index f540e99db90..33fca7a37f8 100644 --- a/java/kotlin-extractor/versions.bzl +++ b/java/kotlin-extractor/versions.bzl @@ -9,6 +9,7 @@ VERSIONS = [ "2.1.20-Beta1", "2.2.0-Beta1", "2.2.20-Beta2", + "2.3.0", ] def _version_to_tuple(v):