[JVM_IR] Deal with inline-class arguments in large arity lambdas.
FunctionNVarargBridgeLowering checked the name of the method instead of whether the method overrides an invoke method. That doesn't work when the name of the function gets mangled because of inline class arguments. Fixed KT-45084.
This commit is contained in:
committed by
Alexander Udalov
parent
1181854bd6
commit
b6fa28ea81
+6
@@ -18272,6 +18272,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
|
||||
+5
-2
@@ -91,8 +91,11 @@ private class FunctionNVarargBridgeLowering(val context: JvmBackendContext) :
|
||||
)
|
||||
|
||||
// Add vararg invoke bridge
|
||||
val invokeFunction = declaration.functions.single {
|
||||
it.name.asString() == "invoke" && it.valueParameters.size == superType.arguments.size - if (it.isSuspend) 0 else 1
|
||||
val invokeFunction = declaration.functions.single { function ->
|
||||
val overridesInvoke = function.overriddenSymbols.any { symbol ->
|
||||
symbol.owner.name.asString() == "invoke"
|
||||
}
|
||||
overridesInvoke && function.valueParameters.size == superType.arguments.size - if (function.isSuspend) 0 else 1
|
||||
}
|
||||
invokeFunction.overriddenSymbols = emptyList()
|
||||
declaration.addBridge(invokeFunction, functionNInvokeFun.owner)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
|
||||
inline class Z(val value: Long)
|
||||
|
||||
fun f(g: (
|
||||
z: Z,
|
||||
p01: Long, p02: Long, p03: Long, p04: Long, p05: Long, p06: Long, p07: Long, p08: Long, p09: Long, p10: Long,
|
||||
p11: Long, p12: Long, p13: Long, p14: Long, p15: Long, p16: Long, p17: Long, p18: Long, p19: Long, p20: Long,
|
||||
p21: Long, p22: Long
|
||||
) -> Unit) {
|
||||
g(Z(42L), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
f { z, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ ->
|
||||
result = if (z.value == 42L) "OK" else "FAIL"
|
||||
}
|
||||
return result
|
||||
}
|
||||
+6
@@ -18248,6 +18248,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
|
||||
+6
@@ -18272,6 +18272,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
|
||||
+5
@@ -15142,6 +15142,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44141.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.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/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -13276,6 +13276,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt");
|
||||
|
||||
Generated
+5
@@ -12687,6 +12687,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt");
|
||||
|
||||
Generated
+5
@@ -12752,6 +12752,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -6902,6 +6902,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt44978.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45084.kt")
|
||||
public void testKt45084() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45084.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt45991.kt")
|
||||
public void testKt45991() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/kt45991.kt");
|
||||
|
||||
Reference in New Issue
Block a user