[K/N] Fix: Ignore bridge functions in FunctionReferenceLowering

^KT-59858
This commit is contained in:
Dmitriy Dolovov
2023-07-04 18:20:33 +02:00
committed by Space Team
parent f3833fdcf8
commit 8aacdb471b
17 changed files with 109 additions and 1 deletions
@@ -48607,6 +48607,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -48607,6 +48607,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
+16
View File
@@ -0,0 +1,16 @@
// MODULE: A
// FILE: A.kt
interface Base {
fun f() : Any
}
fun interface Child : Base {
override fun f() : Int
}
// MODULE: B(A)
// FILE: B.kt
fun box(): String {
if (Child { 10 }.f() != 10) return "FAIL"
return "OK"
}
@@ -45841,6 +45841,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -48607,6 +48607,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -48607,6 +48607,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -38928,6 +38928,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
runTest("compiler/testData/codegen/box/sam/nonInlinedSamWrapper.kt");
@@ -33877,6 +33877,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -33877,6 +33877,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -33877,6 +33877,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -343,7 +343,10 @@ internal class FunctionReferenceLowering(val generationState: NativeGenerationSt
val remappedSuperType = (samSuperType.classOrNull ?: error("Expected a class but was: ${samSuperType.render()}"))
.typeWith(samSuperType.remappedTypeArguments())
superTypes += remappedSuperType
transformedSuperMethod = remappedSuperType.classOrNull!!.functions.single { it.owner.modality == Modality.ABSTRACT }.owner
transformedSuperMethod = remappedSuperType.classOrNull!!.functions.single {
val function = it.owner
function.modality == Modality.ABSTRACT && function.origin !is DECLARATION_ORIGIN_BRIDGE_METHOD
}.owner
} else {
val numberOfParameters = unboundFunctionParameters.size
if (isSuspend) {
@@ -37197,6 +37197,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -38143,6 +38143,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -36725,6 +36725,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -37198,6 +37198,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -33547,6 +33547,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")
@@ -33547,6 +33547,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/sam/kt56188.kt");
}
@Test
@TestMetadata("kt59858.kt")
public void testKt59858() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt59858.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/sam/adapters")
@TestDataPath("$PROJECT_ROOT")