JVM_IR: fix parentClassId for property accessors
This commit is contained in:
+7
-3
@@ -382,7 +382,7 @@ fun IrSimpleType.isRawType(): Boolean =
|
|||||||
hasAnnotation(JvmSymbols.RAW_TYPE_ANNOTATION_FQ_NAME)
|
hasAnnotation(JvmSymbols.RAW_TYPE_ANNOTATION_FQ_NAME)
|
||||||
|
|
||||||
internal fun classFileContainsMethod(classId: ClassId, function: IrFunction, context: JvmBackendContext): Boolean? {
|
internal fun classFileContainsMethod(classId: ClassId, function: IrFunction, context: JvmBackendContext): Boolean? {
|
||||||
val originalSignature = context.methodSignatureMapper.mapSignatureWithGeneric(function).asmMethod
|
val originalSignature = context.methodSignatureMapper.mapAsmMethod(function)
|
||||||
val originalDescriptor = originalSignature.descriptor
|
val originalDescriptor = originalSignature.descriptor
|
||||||
val descriptor = if (function.isSuspend)
|
val descriptor = if (function.isSuspend)
|
||||||
listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation"))
|
listOf(*Type.getArgumentTypes(originalDescriptor), Type.getObjectType("kotlin/coroutines/Continuation"))
|
||||||
@@ -392,12 +392,16 @@ internal fun classFileContainsMethod(classId: ClassId, function: IrFunction, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
val IrMemberWithContainerSource.parentClassId: ClassId?
|
val IrMemberWithContainerSource.parentClassId: ClassId?
|
||||||
get() = (containerSource as? JvmPackagePartSource)?.classId ?: (parent as? IrClass)?.classId
|
get() = ((this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner ?: this).let { directMember ->
|
||||||
|
(directMember.containerSource as? JvmPackagePartSource)?.classId ?: (directMember.parent as? IrClass)?.classId
|
||||||
|
}
|
||||||
|
|
||||||
// Translated into IR-based terms from classifierDescriptor?.classId
|
// Translated into IR-based terms from classifierDescriptor?.classId
|
||||||
val IrClass.classId: ClassId?
|
private val IrClass.classId: ClassId?
|
||||||
get() = when (val parent = parent) {
|
get() = when (val parent = parent) {
|
||||||
is IrExternalPackageFragment -> ClassId(parent.fqName, name)
|
is IrExternalPackageFragment -> ClassId(parent.fqName, name)
|
||||||
|
// TODO: there's `context.classNameOverride`; theoretically it's only relevant for top-level members,
|
||||||
|
// where `containerSource` is a `JvmPackagePartSource` anyway, but I'm not 100% sure.
|
||||||
is IrClass -> parent.classId?.createNestedClassId(name)
|
is IrClass -> parent.classId?.createNestedClassId(name)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ fun f(): String = "O"
|
|||||||
|
|
||||||
val g: String? get() = "K"
|
val g: String? get() = "K"
|
||||||
|
|
||||||
|
inline val h: String get() = ""
|
||||||
|
|
||||||
inline fun <T> i(block: () -> T): T = block()
|
inline fun <T> i(block: () -> T): T = block()
|
||||||
|
|
||||||
// FILE: 2.kt
|
// FILE: 2.kt
|
||||||
|
|
||||||
import foo.bar.*
|
import foo.bar.*
|
||||||
|
|
||||||
fun box(): String = i { f() + g }
|
fun box(): String = i { f() + g + h }
|
||||||
|
|||||||
Reference in New Issue
Block a user