JVM_IR: generate $suspendImpl in interfaces as public

The visibility was the cause of KT-44533; not generating `$suspendImpl`
at all makes `super` calls impossible.

^KT-49106 Fixed
This commit is contained in:
pyos
2021-10-06 12:04:02 +02:00
committed by Ilmir Usmanov
parent b7cfbf031c
commit 1c3a20fab9
6 changed files with 62 additions and 2 deletions
@@ -224,7 +224,10 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower
irFunction,
origin = JvmLoweredDeclarationOrigin.SUSPEND_IMPL_STATIC_FUNCTION,
modality = Modality.OPEN,
visibility = JavaDescriptorVisibilities.PACKAGE_VISIBILITY,
visibility = if (irFunction.parentAsClass.isJvmInterface)
DescriptorVisibilities.PUBLIC
else
JavaDescriptorVisibilities.PACKAGE_VISIBILITY,
isFakeOverride = false,
copyMetadata = false
)
@@ -344,7 +347,7 @@ private class AddContinuationLowering(context: JvmBackendContext) : SuspendLower
}
}
val newFunction = if (function.isOverridable && !function.parentAsClass.isJvmInterface) {
val newFunction = if (function.isOverridable) {
// Create static method for the suspend state machine method so that reentering the method
// does not lead to virtual dispatch to the wrong method.
createStaticSuspendImpl(view).also { result += it }