JVM IR: cast indy-SAM receiver type from KFunctionN to FunctionN
#KT-46512 Fixed
This commit is contained in:
committed by
TeamCityServer
parent
124bd559de
commit
d306d8a90e
+6
@@ -15686,6 +15686,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
|
||||
+7
-1
@@ -167,7 +167,13 @@ internal class SamDelegatingLambdaBuilder(private val jvmContext: JvmBackendCont
|
||||
.irBlockBody {
|
||||
+irReturn(
|
||||
irCall(invokeFunction).also { invokeCall ->
|
||||
invokeCall.dispatchReceiver = irGet(tmp)
|
||||
// We need to cast receiver to the function type because it might have an imaginary type like KFunction2 which
|
||||
// is mapped to KFunction in the codegen by default, which has no 'invoke'. Looks like correct type arguments
|
||||
// are not needed here, so we use "raw" type for simplicity. If that stops working, we'll need to compute the
|
||||
// correct substitution of invocableFunctionClass by visiting tmp.type's hierarchy.
|
||||
val rawFunctionType = invocableFunctionClass.typeWith()
|
||||
|
||||
invokeCall.dispatchReceiver = irImplicitCast(irGet(tmp), rawFunctionType)
|
||||
var parameterIndex = 0
|
||||
invokeFunction.extensionReceiverParameter?.let {
|
||||
invokeCall.extensionReceiver = irGet(lambda.valueParameters[parameterIndex++])
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
class C : Comparable<C> {
|
||||
override fun compareTo(other: C): Int = 0
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val comparator = Comparable<C>::compareTo
|
||||
return if (nullsFirst(comparator).compare(C(), C()) == 0) "OK" else "Fail"
|
||||
}
|
||||
+6
@@ -15662,6 +15662,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
|
||||
+6
@@ -15686,6 +15686,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
|
||||
+5
@@ -12911,6 +12911,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt44827_funInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -11400,6 +11400,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
|
||||
|
||||
Generated
+5
@@ -10811,6 +10811,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
|
||||
|
||||
Generated
+5
@@ -10811,6 +10811,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt45444_privateFunInterface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("multimodule.kt")
|
||||
public void testMultimodule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/multimodule.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -5431,6 +5431,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/funInterface/contravariantIntersectionTypeWithNonTrivialCommonSupertype2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt46512_indyFunInterfaceOverCallableReference.kt")
|
||||
public void testKt46512_indyFunInterfaceOverCallableReference() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/funInterface/kt46512_indyFunInterfaceOverCallableReference.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/funInterface/equality")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user