diff --git a/MODULE.bazel b/MODULE.bazel index d1945a7ad8b..1fbe5c3d0ac 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-Beta2", "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-Beta2", "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-Beta2", ) go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk") diff --git a/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar new file mode 100644 index 00000000000..81c85be0107 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6ed7d52fa82ae3837e63b6f110a8e25ef807c773c1597f93fb3a1e509e2624c6 +size 59087152 diff --git a/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar new file mode 100644 index 00000000000..aa1aed82c11 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-compiler-embeddable-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d66c146d383a7b8463cb1a0fc9bbff9b0db0b136a465730a338f1fc2bf160f1c +size 57665679 diff --git a/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar new file mode 100644 index 00000000000..e0151662ad5 --- /dev/null +++ b/java/kotlin-extractor/deps/kotlin-stdlib-2.3.0-Beta2.jar @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fb35d6a1bf6df0a5a4e78307c92885f63878a53499cc2800f0ba706e527ab615 +size 1796815 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..b7ae04934e1 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-Beta2", ] def _version_to_tuple(v):