Fix problem with empty vararg of boxed primitives in JVM_IR

When calling a generic Java generic method with vararg parameters with empty
vararg, incorrect array creation instruction was generated for primitive type:
NEWARRAY T_INT instead of ANEWARRAY java/lang/Integer. Here for Java method

  public static <T> void takesVarargOfT(T x1, T... xs) {}

corresponding vararg parameter was considered to be of type 'Array<T>?',
which is not a non-null array type, so, NewArray intrinsic failed to generate
proper bytecode.
This commit is contained in:
Dmitry Petrov
2019-12-27 16:12:16 +03:00
parent 0667ee9796
commit 98bf0e278f
7 changed files with 67 additions and 2 deletions
@@ -28301,6 +28301,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/vararg/doNotCopyImmediatelyCreatedArrays.kt");
}
@TestMetadata("emptyVarargOfBoxedPrimitiveType.kt")
public void testEmptyVarargOfBoxedPrimitiveType() throws Exception {
runTest("compiler/testData/codegen/box/vararg/emptyVarargOfBoxedPrimitiveType.kt");
}
@TestMetadata("kt1978.kt")
public void testKt1978() throws Exception {
runTest("compiler/testData/codegen/box/vararg/kt1978.kt");