Skip to content

Commit 43f9331

Browse files
committed
Kotlin: adjust extracted property reference base class
1 parent 92b425b commit 43f9331

File tree

3 files changed

+22
-35
lines changed

3 files changed

+22
-35
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4211,9 +4211,11 @@ open class KotlinFileExtractor(
42114211
* this.dispatchReceiver = dispatchReceiver
42124212
* }
42134213
*
4214-
* fun get(): R { return this.dispatchReceiver.FN1() }
4214+
* override fun get(): R { return this.dispatchReceiver.FN1() }
42154215
*
4216-
* fun set(a0: R): Unit { return this.dispatchReceiver.FN2(a0) }
4216+
* override fun set(a0: R): Unit { return this.dispatchReceiver.FN2(a0) }
4217+
*
4218+
* override fun invoke(): R { return this.get() }
42174219
* }
42184220
* ```
42194221
*
@@ -4251,8 +4253,8 @@ open class KotlinFileExtractor(
42514253
)
42524254

42534255
val declarationParent = peekDeclStackAsDeclarationParent(propertyReferenceExpr) ?: return
4254-
val prefix = if (kPropertyClass.owner.name.asString().startsWith("KMutableProperty")) "Mutable" else ""
4255-
val baseClass = pluginContext.referenceClass(FqName("kotlin.jvm.internal.${prefix}PropertyReference${kPropertyType.arguments.size - 1}"))?.owner?.typeWith()
4256+
// The base class could be `Any`. `PropertyReference` is used to keep symmetry with function references.
4257+
val baseClass = pluginContext.referenceClass(FqName("kotlin.jvm.internal.PropertyReference"))?.owner?.typeWith()
42564258
?: pluginContext.irBuiltIns.anyType
42574259

42584260
val classId = extractGeneratedClass(ids, listOf(baseClass, kPropertyType), locId, propertyReferenceExpr, declarationParent)

0 commit comments

Comments
 (0)