Skip to content

Commit 144510c

Browse files
committed
Kotlin: Add support for Kotlin 2.3.0-Beta2
1 parent 90dd3b9 commit 144510c

File tree

7 files changed

+26
-6
lines changed

7 files changed

+26
-6
lines changed

MODULE.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ use_repo(
230230
"kotlin-compiler-2.1.20-Beta1",
231231
"kotlin-compiler-2.2.0-Beta1",
232232
"kotlin-compiler-2.2.20-Beta2",
233+
"kotlin-compiler-2.3.0-Beta2",
233234
"kotlin-compiler-embeddable-1.8.0",
234235
"kotlin-compiler-embeddable-1.9.0-Beta",
235236
"kotlin-compiler-embeddable-1.9.20-Beta",
@@ -239,6 +240,7 @@ use_repo(
239240
"kotlin-compiler-embeddable-2.1.20-Beta1",
240241
"kotlin-compiler-embeddable-2.2.0-Beta1",
241242
"kotlin-compiler-embeddable-2.2.20-Beta2",
243+
"kotlin-compiler-embeddable-2.3.0-Beta2",
242244
"kotlin-stdlib-1.8.0",
243245
"kotlin-stdlib-1.9.0-Beta",
244246
"kotlin-stdlib-1.9.20-Beta",
@@ -248,6 +250,7 @@ use_repo(
248250
"kotlin-stdlib-2.1.20-Beta1",
249251
"kotlin-stdlib-2.2.0-Beta1",
250252
"kotlin-stdlib-2.2.20-Beta2",
253+
"kotlin-stdlib-2.3.0-Beta2",
251254
)
252255

253256
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:6ed7d52fa82ae3837e63b6f110a8e25ef807c773c1597f93fb3a1e509e2624c6
3+
size 59087152
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:d66c146d383a7b8463cb1a0fc9bbff9b0db0b136a465730a338f1fc2bf160f1c
3+
size 57665679
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:fb35d6a1bf6df0a5a4e78307c92885f63878a53499cc2800f0ba706e527ab615
3+
size 1796815

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@ open class KotlinFileExtractor(
16451645
extractMethodAndParameterTypeAccesses: Boolean,
16461646
typeSubstitution: TypeSubstitution?,
16471647
classTypeArgsIncludingOuterClasses: List<IrTypeArgument>?
1648-
) =
1648+
) : Label<out DbCallable> =
16491649
forceExtractFunction(
16501650
f,
16511651
parentId,
@@ -2975,12 +2975,22 @@ open class KotlinFileExtractor(
29752975
val locId = tw.getLocation(s)
29762976
tw.writeStmts_block(blockId, parent, idx, callable)
29772977
tw.writeHasLocation(blockId, locId)
2978-
extractVariable(s.delegate, callable, blockId, 0)
2978+
// For Kotlin < 2.3, s.deligate is not-nullable. Cast to a be nullable,
2979+
// as a workaround to silence warnings for kotlin < 2.3 about the elvis
2980+
// operator being redundant.
2981+
// For Kotlin >= 2.3, the cast is redundant, so we need to silence that warning
2982+
2983+
@Suppress("USELESS_CAST")
2984+
val delegate = (s.delegate as IrVariable?) ?: run {
2985+
logger.errorElement("Local delegated property is missing delegate", s)
2986+
return
2987+
}
2988+
extractVariable(delegate, callable, blockId, 0)
29792989

29802990
val propId = tw.getFreshIdLabel<DbKt_property>()
29812991
tw.writeKtProperties(propId, s.name.asString())
29822992
tw.writeHasLocation(propId, locId)
2983-
tw.writeKtPropertyDelegates(propId, useVariable(s.delegate))
2993+
tw.writeKtPropertyDelegates(propId, useVariable(delegate))
29842994

29852995
// Getter:
29862996
extractStatement(s.getter, callable, blockId, 1)

java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,9 +849,6 @@ open class KotlinUsesExtractor(
849849
}
850850

851851
private fun useSimpleType(s: IrSimpleType, context: TypeContext): TypeResults {
852-
if (s.abbreviation != null) {
853-
// TODO: Extract this information
854-
}
855852
// We use this when we don't actually have an IrClass for a class
856853
// we want to refer to
857854
// TODO: Eliminate the need for this if possible

java/kotlin-extractor/versions.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VERSIONS = [
99
"2.1.20-Beta1",
1010
"2.2.0-Beta1",
1111
"2.2.20-Beta2",
12+
"2.3.0-Beta2",
1213
]
1314

1415
def _version_to_tuple(v):

0 commit comments

Comments
 (0)