JVM IR: Resolve fake overrides when calculating return types (KT-44867)
This commit is contained in:
committed by
Alexander Udalov
parent
cae95b1ba0
commit
d0424465b8
+6
@@ -17776,6 +17776,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
|
||||
+2
-2
@@ -497,7 +497,7 @@ class ExpressionCodegen(
|
||||
// is methods that do not pass through the state machine generating MethodVisitor, since getting
|
||||
// COROUTINE_SUSPENDED here is still possible; luckily, all those methods are bridges.
|
||||
if (callable.asmMethod.returnType != Type.VOID_TYPE)
|
||||
MaterialValue(this, callable.asmMethod.returnType, callee.returnType).discard()
|
||||
MaterialValue(this, callable.asmMethod.returnType, callable.returnType).discard()
|
||||
// don't generate redundant UNIT/pop instructions
|
||||
unitValue
|
||||
}
|
||||
@@ -522,7 +522,7 @@ class ExpressionCodegen(
|
||||
}
|
||||
}
|
||||
else ->
|
||||
MaterialValue(this, callable.asmMethod.returnType, callee.returnType)
|
||||
MaterialValue(this, callable.asmMethod.returnType, callable.returnType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.jvm.codegen
|
||||
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind
|
||||
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature
|
||||
import org.jetbrains.org.objectweb.asm.Type
|
||||
@@ -15,7 +16,8 @@ class IrCallableMethod(
|
||||
val owner: Type,
|
||||
val invokeOpcode: Int,
|
||||
val signature: JvmMethodSignature,
|
||||
val isInterfaceMethod: Boolean
|
||||
val isInterfaceMethod: Boolean,
|
||||
val returnType: IrType,
|
||||
) {
|
||||
val asmMethod: Method = signature.asmMethod
|
||||
|
||||
|
||||
+1
-1
@@ -418,7 +418,7 @@ class MethodSignatureMapper(private val context: JvmBackendContext) {
|
||||
?: mapSignatureSkipGeneric(declaration)
|
||||
}
|
||||
|
||||
return IrCallableMethod(owner, invokeOpcode, signature, isInterface)
|
||||
return IrCallableMethod(owner, invokeOpcode, signature, isInterface, declaration.returnType)
|
||||
}
|
||||
|
||||
// TODO: get rid of this (probably via some special lowering)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
open class BaseWrapper<T>(val response: T)
|
||||
class Wrapper(result: Result<String>) : BaseWrapper<Result<String>>(result)
|
||||
|
||||
fun box(): String {
|
||||
return Wrapper(Result.success("OK")).response.getOrThrow()
|
||||
}
|
||||
+6
@@ -17776,6 +17776,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
|
||||
+6
@@ -17776,6 +17776,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
|
||||
+5
@@ -14133,6 +14133,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt32793.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void ignoreKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("simpleSecondaryConstructor.kt")
|
||||
public void ignoreSimpleSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -12934,6 +12934,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
|
||||
Generated
+5
@@ -12391,6 +12391,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
|
||||
Generated
+5
@@ -12456,6 +12456,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -6787,6 +6787,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt44867.kt")
|
||||
public void testKt44867() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44867.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||
public void testMangledDefaultParameterFunction() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
|
||||
Reference in New Issue
Block a user