(Un)mute and add tests for vararg codegen
This commit is contained in:
committed by
max-kammerer
parent
d22814f6da
commit
ac667403ef
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// See also KT-6299
|
||||
public open class Outer private constructor(val s: String, vararg i: Int) {
|
||||
class Inner: Outer("xyz")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun <reified T> f(): Array<T> = arrayOf()
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
f<String>()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
inline fun <reified T> f(x : () -> Unit) {
|
||||
object { init { "OK" is T } }
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
f<String>() {}
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
// There is one ANEWARRAY instruction here, to generate the default parameter value.
|
||||
fun default(vararg s: String = arrayOf("OK")) = s[0]
|
||||
|
||||
|
||||
compiler/testData/codegen/bytecodeText/inlineClasses/passInlineClassesWithSpreadOperatorToVarargs.kt
Vendored
+8
-4
@@ -9,7 +9,7 @@ inline class UInt(val u: Int)
|
||||
fun <T> takeVarargs(vararg e: T) {}
|
||||
|
||||
fun test(u1: UInt, u2: UInt, us: Array<UInt>) {
|
||||
takeVarargs(*us) // copy + checkcast
|
||||
takeVarargs(*us) // copy + checkcast (on non-ir backend)
|
||||
takeVarargs(u1, u2, *us) // 2 box + ...
|
||||
}
|
||||
|
||||
@@ -17,9 +17,13 @@ fun test(u1: UInt, u2: UInt, us: Array<UInt>) {
|
||||
// 2 INVOKESTATIC UInt\.box
|
||||
// 0 INVOKEVIRTUAL UInt.unbox
|
||||
|
||||
// 2 CHECKCAST \[LUInt
|
||||
|
||||
// 0 CHECKCAST \[Ljava/lang/Integer
|
||||
|
||||
// 0 intValue
|
||||
// 0 valueOf
|
||||
// 0 valueOf
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// 2 CHECKCAST \[LUInt
|
||||
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 CHECKCAST \[LUInt
|
||||
|
||||
+1
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun booleanVararg(vararg xs: Boolean) {}
|
||||
fun byteVararg(vararg xs: Byte) {}
|
||||
fun shortVararg(vararg xs: Short) {}
|
||||
@@ -74,5 +73,6 @@ fun test() {
|
||||
genericVararg(xs = *arrayOfNulls<Int>(1))
|
||||
}
|
||||
|
||||
// 0 arraycopy
|
||||
// 0 copyOf
|
||||
// 0 clone
|
||||
+10
@@ -2672,6 +2672,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayOf.kt")
|
||||
public void testArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLambda.kt")
|
||||
public void testCapturedLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt");
|
||||
@@ -2737,6 +2742,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt8047_2.kt")
|
||||
public void testKt8047_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9637.kt")
|
||||
public void testKt9637() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt9637.kt");
|
||||
|
||||
Generated
+10
@@ -2672,6 +2672,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayOf.kt")
|
||||
public void testArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLambda.kt")
|
||||
public void testCapturedLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt");
|
||||
@@ -2737,6 +2742,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt8047_2.kt")
|
||||
public void testKt8047_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9637.kt")
|
||||
public void testKt9637() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt9637.kt");
|
||||
|
||||
+10
@@ -2672,6 +2672,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("arrayOf.kt")
|
||||
public void testArrayOf() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/arrayOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("capturedLambda.kt")
|
||||
public void testCapturedLambda() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/capturedLambda.kt");
|
||||
@@ -2737,6 +2742,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt8047_2.kt")
|
||||
public void testKt8047_2() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt8047_2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt9637.kt")
|
||||
public void testKt9637() throws Exception {
|
||||
runTest("compiler/testData/codegen/boxInline/reified/kt9637.kt");
|
||||
|
||||
Reference in New Issue
Block a user