[JVM_IR] Determine correct type of empty varargs array.

When calling vararg methods with a generic vararg type without
passing explicit parameters, we have to allocate an empty array
of the right type. We failed to do so previously, as we did
not take the type arguments for the dispatch receiver into
account.
This commit is contained in:
Mads Ager
2020-10-29 08:10:39 +01:00
committed by Alexander Udalov
parent ffc003c051
commit 1ecf5943ab
9 changed files with 179 additions and 8 deletions
@@ -1096,6 +1096,34 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxAga
}
}
@TestMetadata("compiler/testData/codegen/boxAgainstJava/varargs")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Varargs extends AbstractBlackBoxAgainstJavaCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInVarargs() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxAgainstJava/varargs"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("varargsOverride.kt")
public void testVarargsOverride() throws Exception {
runTest("compiler/testData/codegen/boxAgainstJava/varargs/varargsOverride.kt");
}
@TestMetadata("varargsOverride2.kt")
public void testVarargsOverride2() throws Exception {
runTest("compiler/testData/codegen/boxAgainstJava/varargs/varargsOverride2.kt");
}
@TestMetadata("varargsOverride3.kt")
public void testVarargsOverride3() throws Exception {
runTest("compiler/testData/codegen/boxAgainstJava/varargs/varargsOverride3.kt");
}
}
@TestMetadata("compiler/testData/codegen/boxAgainstJava/visibility")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)