Check if there is bridge by signatures instead of IR
#KT-50649 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
8fe4e9030f
commit
b794b0f1be
+12
@@ -22109,6 +22109,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+2
-4
@@ -694,13 +694,11 @@ class ExpressionCodegen(
|
|||||||
// Otherwise, we need to treat `Result` as boxed if it overrides a non-`Result` or boxed `Result` type.
|
// Otherwise, we need to treat `Result` as boxed if it overrides a non-`Result` or boxed `Result` type.
|
||||||
// TODO: if results of `needsResultArgumentUnboxing` for `overriddenSymbols` are inconsistent, the boxedness
|
// TODO: if results of `needsResultArgumentUnboxing` for `overriddenSymbols` are inconsistent, the boxedness
|
||||||
// of the `Result` depends on which overridden function is called. This is probably unfixable.
|
// of the `Result` depends on which overridden function is called. This is probably unfixable.
|
||||||
|
val signature = methodSignatureMapper.mapAsmMethod(this)
|
||||||
val parent = this.parent
|
val parent = this.parent
|
||||||
return parent is IrClass &&
|
return parent is IrClass &&
|
||||||
parent.functions.none {
|
|
||||||
it != this && it.origin == IrDeclarationOrigin.BRIDGE && it.attributeOwnerId == attributeOwnerId
|
|
||||||
} &&
|
|
||||||
overriddenSymbols.any {
|
overriddenSymbols.any {
|
||||||
it.owner.resultIsActuallyAny(index) != false
|
methodSignatureMapper.mapAsmMethod(it.owner) == signature && it.owner.resultIsActuallyAny(index) != false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
interface Operation<T> {
|
||||||
|
fun performOperation(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
object ResultOperation : Operation<Result<Int>> {
|
||||||
|
override fun performOperation(): Result<Int> {
|
||||||
|
return Result.success(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
fun box(): String {
|
||||||
|
val x = ResultOperation.performOperation()
|
||||||
|
if ("$x" != "Success(1)") return "$x"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
// FILE: lib.kt
|
||||||
|
interface Operation<T> {
|
||||||
|
fun performOperation(): T
|
||||||
|
}
|
||||||
|
|
||||||
|
object ResultOperation : Operation<Result<Int>> {
|
||||||
|
override fun performOperation(): Result<Int> {
|
||||||
|
return Result.success(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
fun box(): String {
|
||||||
|
val x = ResultOperation.performOperation()
|
||||||
|
if ("$x" != "Success(1)") return "$x"
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+12
@@ -21689,6 +21689,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+12
@@ -22109,6 +22109,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+10
@@ -18196,6 +18196,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/returnResult")
|
@TestMetadata("compiler/testData/codegen/box/inlineClasses/returnResult")
|
||||||
|
|||||||
+12
@@ -17203,6 +17203,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+12
@@ -17167,6 +17167,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+10
@@ -14586,6 +14586,16 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/box/inlineClasses/returnResult")
|
@TestMetadata("compiler/testData/codegen/box/inlineClasses/returnResult")
|
||||||
|
|||||||
Generated
+12
@@ -18971,6 +18971,18 @@ public class ExternalTestGenerated extends AbstractExternalNativeBlackBoxTest {
|
|||||||
public void testLambdaTakesResultThroughBridge() throws Exception {
|
public void testLambdaTakesResultThroughBridge() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/result/lambdaTakesResultThroughBridge.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericMultiModule.kt")
|
||||||
|
public void testReturnGenericMultiModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericMultiModule.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("returnGenericSingleModule.kt")
|
||||||
|
public void testReturnGenericSingleModule() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/result/returnGenericSingleModule.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user