JVM IR: fail when SyntheticAccessorLowering adds accessor to other files
This would help for example in debugging the issue fixed in the previous commit. The only problem by now where this lowering tried to add accessors to foreign files was reproduced for interfaces inheriting from Cloneable. There, we generate a DefaultImpls bridge that calls protected method `clone` from java.lang.Cloneable.DefaultImpls. This makes no sense, but the old backend behaves the same. Instead of generating accessor for it in JVM IR, we now see all DefaultImpls bridges as public as a workaround. (The fact that assertion no longer fails here is checked e.g. by box/reflection/mapping/methodsFromObject.kt.)
This commit is contained in:
@@ -11,9 +11,9 @@ import org.jetbrains.kotlin.backend.common.deepCopyWithVariables
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||
import org.jetbrains.kotlin.ir.builders.Scope
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -514,6 +514,7 @@ fun createStaticFunctionWithReceivers(
|
||||
dispatchReceiverType: IrType? = oldFunction.dispatchReceiverParameter?.type,
|
||||
origin: IrDeclarationOrigin = oldFunction.origin,
|
||||
modality: Modality = Modality.FINAL,
|
||||
visibility: Visibility = oldFunction.visibility,
|
||||
copyMetadata: Boolean = true
|
||||
): IrSimpleFunction {
|
||||
val descriptor = (oldFunction.descriptor as? DescriptorWithContainerSource)?.let {
|
||||
@@ -524,7 +525,7 @@ fun createStaticFunctionWithReceivers(
|
||||
origin,
|
||||
IrSimpleFunctionSymbolImpl(descriptor),
|
||||
name,
|
||||
oldFunction.visibility,
|
||||
visibility,
|
||||
modality,
|
||||
oldFunction.returnType,
|
||||
isInline = oldFunction.isInline,
|
||||
|
||||
Reference in New Issue
Block a user