JVM_IR: repair super calls to methods of Any
This commit is contained in:
+4
-1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.common.ir.isMethodOfAny
|
||||||
import org.jetbrains.kotlin.backend.common.ir.isTopLevel
|
import org.jetbrains.kotlin.backend.common.ir.isTopLevel
|
||||||
import org.jetbrains.kotlin.backend.common.lower.allOverridden
|
import org.jetbrains.kotlin.backend.common.lower.allOverridden
|
||||||
import org.jetbrains.kotlin.backend.common.lower.parentsWithSelf
|
import org.jetbrains.kotlin.backend.common.lower.parentsWithSelf
|
||||||
@@ -358,7 +359,9 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (isSuperCall && !current.parentAsClass.isInterface &&
|
if (isSuperCall && !current.parentAsClass.isInterface &&
|
||||||
current.resolveFakeOverride()?.isCompiledToJvmDefault(context.state.jvmDefaultMode) != true
|
current.resolveFakeOverride()?.run {
|
||||||
|
isMethodOfAny() || !isCompiledToJvmDefault(context.state.jvmDefaultMode)
|
||||||
|
} == true
|
||||||
) {
|
) {
|
||||||
return current
|
return current
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
interface A
|
||||||
|
|
||||||
|
abstract class Base: A
|
||||||
|
|
||||||
|
class Derived : Base() {
|
||||||
|
override fun toString() = super.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1 INVOKESPECIAL Base.toString
|
||||||
@@ -409,6 +409,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("superToString.kt")
|
||||||
|
public void testSuperToString() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/superToString.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
||||||
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
||||||
|
|||||||
+5
@@ -409,6 +409,11 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
runTest("compiler/testData/codegen/bytecodeText/superFlagInMultiFileFacade.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("superToString.kt")
|
||||||
|
public void testSuperToString() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/bytecodeText/superToString.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
@TestMetadata("suspendCoroutineUninterceptedOrReturn.kt")
|
||||||
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
public void testSuspendCoroutineUninterceptedOrReturn() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
runTest("compiler/testData/codegen/bytecodeText/suspendCoroutineUninterceptedOrReturn.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user