Fix function invocation mangling rule

Mangle invocations of functions with value classes in signature which
override (directly or indirectly) a method declared in Kotlin code.
Otherwise, NoSuchMethodError is being thrown.

^KT-55945: Fixed
This commit is contained in:
vladislav.grechko
2023-02-07 20:59:30 +01:00
committed by Space Team
parent f80ed4592d
commit 457837a255
29 changed files with 744 additions and 4 deletions
@@ -25795,6 +25795,42 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
public void testInlineClasInSignatureNullable() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt");
}
@Test
@TestMetadata("kt55945.kt")
public void testKt55945() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt");
}
@Test
@TestMetadata("methodWithInlineClassDeclaredInJava.kt")
public void testMethodWithInlineClassDeclaredInJava() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt");
}
@Test
@TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt")
public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt")
public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt");
}
@Test
@TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt")
public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("oldFunctionMangling.kt")
public void testOldFunctionMangling() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt");
}
}
@Nested
@@ -52528,6 +52564,40 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
public void testVisibility() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/visibility.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop")
@TestDataPath("$PROJECT_ROOT")
public class JavaInterop {
@Test
public void testAllFilesPresentInJavaInterop() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("methodWithValueClassDeclaredInJava.kt")
public void testMethodWithValueClassDeclaredInJava() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt");
}
@Test
@TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt")
public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt")
public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt");
}
@Test
@TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt")
public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt");
}
}
}
@Nested
@@ -25795,6 +25795,42 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
public void testInlineClasInSignatureNullable() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/inlineClasInSignatureNullable.kt");
}
@Test
@TestMetadata("kt55945.kt")
public void testKt55945() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/kt55945.kt");
}
@Test
@TestMetadata("methodWithInlineClassDeclaredInJava.kt")
public void testMethodWithInlineClassDeclaredInJava() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJava.kt");
}
@Test
@TestMetadata("methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt")
public void testMethodWithInlineClassDeclaredInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassDeclaredInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("methodWithInlineClassInheritedBothFromJavaAndKotlin.kt")
public void testMethodWithInlineClassInheritedBothFromJavaAndKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedBothFromJavaAndKotlin.kt");
}
@Test
@TestMetadata("methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt")
public void testMethodWithInlineClassInheritedInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/methodWithInlineClassInheritedInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("oldFunctionMangling.kt")
public void testOldFunctionMangling() throws Exception {
runTest("compiler/testData/codegen/box/inlineClasses/javaInterop/oldFunctionMangling.kt");
}
}
@Nested
@@ -52528,6 +52564,40 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
public void testVisibility() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/visibility.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/box/valueClasses/javaInterop")
@TestDataPath("$PROJECT_ROOT")
public class JavaInterop {
@Test
public void testAllFilesPresentInJavaInterop() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/valueClasses/javaInterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("methodWithValueClassDeclaredInJava.kt")
public void testMethodWithValueClassDeclaredInJava() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJava.kt");
}
@Test
@TestMetadata("methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt")
public void testMethodWithValueClassDeclaredInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassDeclaredInJavaOverriddenInKotlin.kt");
}
@Test
@TestMetadata("methodWithValueClassInheritedBothFromJavaAndKotlin.kt")
public void testMethodWithValueClassInheritedBothFromJavaAndKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedBothFromJavaAndKotlin.kt");
}
@Test
@TestMetadata("methodWithValueClassInheritedInJavaOverriddenInKotlin.kt")
public void testMethodWithValueClassInheritedInJavaOverriddenInKotlin() throws Exception {
runTest("compiler/testData/codegen/box/valueClasses/javaInterop/methodWithValueClassInheritedInJavaOverriddenInKotlin.kt");
}
}
}
@Nested