diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/casts.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/casts.kt new file mode 100644 index 00000000000..deda6a18570 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/casts.kt @@ -0,0 +1,17 @@ + +import kotlin.test.assertEquals + +inline fun foo(x : R?, block : (R?) -> T) : T { + return block(x) +} + +fun box() : String { + assertEquals(1L, foo(1) { x -> x!!.toLong() }) + assertEquals(1.toShort(), foo(1) { x -> x!!.toShort() }) + assertEquals(1.toByte(), foo(1L) { x -> x!!.toByte() }) + assertEquals(1.toShort(), foo(1L) { x -> x!!.toShort() }) + assertEquals('a'.toDouble(), foo('a') { x -> x!!.toDouble() }) + assertEquals(1.0.toByte(), foo(1.0) { x -> x!!.toByte() }) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/checkcastAndInstanceOf.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/checkcastAndInstanceOf.kt new file mode 100644 index 00000000000..5654b449964 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/checkcastAndInstanceOf.kt @@ -0,0 +1,22 @@ + +import kotlin.test.assertEquals + +inline fun foo(x : R, y : R, block : (R) -> T) : T { + val a = x is Number + val b = x is Object + + val b1 = x as Object + + if (a && b) { + return block(x) + } else { + return block(y) + } +} + +fun box() : String { + assertEquals(1, foo(1, 2) { x -> x as Int }) + assertEquals("def", foo("abc", "def") { x -> x as String }) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/fold.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/fold.kt new file mode 100644 index 00000000000..c5867716d32 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/fold.kt @@ -0,0 +1,13 @@ + +import kotlin.test.assertEquals + +fun box() : String { + val x = LongArray(5) + for (i in 0..4) { + x[i] = (i + 1).toLong() + } + + assertEquals(15L, x.fold(0L) { x, y -> x + y }) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/nullCheck.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/nullCheck.kt new file mode 100644 index 00000000000..ef15a3b75e5 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/nullCheck.kt @@ -0,0 +1,16 @@ + +import kotlin.test.assertEquals + +inline fun foo(x : R?, y : R?, block : (R?) -> T) : T { + if (x == null) { + return block(x) + } else { + return block(y) + } +} + +fun box() : String { + assertEquals(3, foo(1, 2) { x -> if (x != null) 3 else 4 }) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/progressions.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/progressions.kt new file mode 100644 index 00000000000..6cef177bbca --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/progressions.kt @@ -0,0 +1,28 @@ + +import kotlin.test.assertEquals + +fun box() : String { + + val result1 = (1..100).count { x -> x % 2 == 0 } + val result2 = (1..100).filter { x -> x % 2 == 0 }.size() + assertEquals(result1, 50) + assertEquals(result2, 50) + + val result3 = (1..100).map { x -> 2 * x }.count { x -> x % 2 == 0 } + val result4 = (1..100).map { x -> 2 * x }.filter { x -> x % 2 == 0 }.size() + assertEquals(result3, 100) + assertEquals(result4, 100) + + val result5 = (1L..100L).count { x -> x % 2 == 0L } + val result6 = (1L..100L).filter { x -> x % 2 == 0L }.size() + assertEquals(result5, 50) + assertEquals(result6, 50) + + val result7 = (1L..100L).map { x -> 2 * x }.count { x -> x % 2 == 0L } + val result8 = (1L..100L).map { x -> 2 * x }.filter { x -> x % 2 == 0L }.size() + assertEquals(result7, 100) + assertEquals(result8, 100) + + return "OK" +} + diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/safeCallWithElvis.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/safeCallWithElvis.kt new file mode 100644 index 00000000000..e25a93221bd --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/safeCallWithElvis.kt @@ -0,0 +1,28 @@ + +import kotlin.test.assertEquals + +class A(val x : Int, val y : A?) + +fun check(a : A?) : Int { + return a?.y?.x ?: (a?.x ?: 3) +} + +fun checkLeftAssoc(a : A?) : Int { + return (a?.y?.x ?: a?.x) ?: 3 +} + +fun box() : String { + val a1 = A(2, A(1, null)) + val a2 = A(2, null) + val a3 = null + + assertEquals(1, check(a1)) + assertEquals(2, check(a2)) + assertEquals(3, check(a3)) + + assertEquals(1, checkLeftAssoc(a1)) + assertEquals(2, checkLeftAssoc(a2)) + assertEquals(3, checkLeftAssoc(a3)) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/simple.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/simple.kt new file mode 100644 index 00000000000..87df3f72ff1 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/simple.kt @@ -0,0 +1,12 @@ +import kotlin.test.assertEquals + +inline fun foo(x : R, block : (R) -> R) : R { + return block(x) +} + +fun box() : String { + val result = foo(1) { x -> x + 1 } + assertEquals(2, result) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt new file mode 100644 index 00000000000..f55d18f0020 --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt @@ -0,0 +1,34 @@ + +import kotlin.test.assertEquals + +fun returningBoxed() : Int? = 1 +fun acceptingBoxed(x : Int?) : Int ? = x + +class A(var x : Int? = null) + +fun box() : String { + assertEquals(1, returningBoxed()) + assertEquals(1, acceptingBoxed(1)) + + val a = A() + a.x = 1 + assertEquals(1, a.x) + + val b = Array(1, { null }) + b[0] = 1 + assertEquals(1, b[0]) + + val x = 1 : Int? + assertEquals(1, x!!.hashCode()) + + val y = 1000 : Int? + val z = 1000 : Int? + val res = y.identityEquals(z) + + val c1: Any = if (1 == 1) 0 else "abc" + val c2: Any = if (1 != 1) 0 else "abc" + assertEquals(0, c1) + assertEquals("abc", c2) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithStdlib/boxingOptimization/variables.kt b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/variables.kt new file mode 100644 index 00000000000..6f701ece55f --- /dev/null +++ b/compiler/testData/codegen/boxWithStdlib/boxingOptimization/variables.kt @@ -0,0 +1,22 @@ + +import kotlin.test.assertEquals + +inline fun foo(x : R, block : (R) -> T) : T { + var y = x + var z = y + z = x + return block(z) +} + +fun box() : String { + assertEquals(1, foo(1) { x -> x }) + assertEquals(1f, foo(1f) { x -> x }) + assertEquals(1L, foo(1L) { x -> x }) + assertEquals(1.toDouble(), foo(1.toDouble()) { x -> x }) + assertEquals(1.toShort(), foo(1.toShort()) { x -> x }) + assertEquals(1.toByte(), foo(1.toByte()) { x -> x }) + assertEquals('a', foo('a') { x -> x }) + assertEquals(true, foo(true) { x -> x }) + + return "OK" +} diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/casts.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/casts.kt new file mode 100644 index 00000000000..ca0d25fa198 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/casts.kt @@ -0,0 +1,22 @@ + +inline fun foo(x : R?, block : (R?) -> T) : T { + return block(x) +} + +fun bar() { + foo(1) { x -> x!!.toLong() } + foo(1) { x -> x!!.toShort() } + foo(1L) { x -> x!!.toByte() } + foo(1L) { x -> x!!.toShort() } + foo('a') { x -> x!!.toDouble() } + foo(1.0) { x -> x!!.toByte() } +} + +// 0 valueOf +// 0 Value\s\(\) +// 1 I2L +// 2 L2I +// 2 I2S +// 2 I2B +// 1 I2D +// 1 D2I diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/checkcastAndInstanceOf.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/checkcastAndInstanceOf.kt new file mode 100644 index 00000000000..caa17e94201 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/checkcastAndInstanceOf.kt @@ -0,0 +1,23 @@ + +inline fun foo(x : R, y : R, block : (R) -> T) : T { + val a = x is Number + val b = x is Object + + val a1 = x as Number + val b1 = x as Object + + if (a && b) { + return block(x) + } else { + return block(y) + } +} + +fun bar() { + foo(1, 2) { x -> x is Int } +} + +// 0 valueOf +// 0 Value\s\(\) +// 2 INSTANCEOF +// 2 CHECKCAST diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt new file mode 100644 index 00000000000..0b9a0237a0f --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt @@ -0,0 +1,13 @@ + +fun foo() : Long { + val x = LongArray(5) + + for (i in 0..4) { + x[i] = (i + 1).toLong() + } + + return x.fold(0L) { x, y -> x + y } +} + +// 0 valueOf +// 0 Value\s\(\) diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/nullCheck.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/nullCheck.kt new file mode 100644 index 00000000000..7190436651f --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/nullCheck.kt @@ -0,0 +1,17 @@ + +inline fun foo(x : R?, y : R?, block : (R?) -> T) : T { + if (x == null) { + return block(x) + } else { + return block(y) + } +} + +fun bar() { + foo(1, 2) { x -> if (x != null) 1 else 2 } +} + +// 0 valueOf +// 0 Value\s\(\) +// 1 IFNULL +// 0 IFNONNULL diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/progressions.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/progressions.kt new file mode 100644 index 00000000000..676e3a91e34 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/progressions.kt @@ -0,0 +1,37 @@ + +inline fun > foo(x : T, block : (R) -> R) : R { + val y = x.iterator() + if (y.hasNext()) { + return block(y.next()) + } else { + throw RuntimeException() + } +} + +fun bar() { + foo((1..100)) { x -> x + 1 } + foo((1L..100L)) { x -> x + 1 } + foo((1.0.toDouble()..2.0.toDouble())) { x -> x + 1 } + foo((1.0f..2.0f)) { x -> x + 1 } + foo((1.toByte()..100.toByte())) { x -> x } + foo((1.toShort()..100.toShort())) { x -> x } + foo(('a'..'z')) { x -> x } + + foo(IntRange(1, 100)) { x -> x + 1 } + foo(LongRange(1L, 100L)) { x -> x + 1 } + foo(DoubleRange(1.0, 2.0)) { x -> x + 1 } + foo(FloatRange(1.0f, 2.0f)) { x -> x + 1 } + foo(ByteRange(1.toByte(), 100.toByte())) { x -> x } + foo(ShortRange(1.toShort(), 100.toShort())) { x -> x } + foo(CharRange('a', 'z')) { x -> x } +} + +// 1 next\s\( +// 2 nextInt +// 2 nextLong +// 2 nextDouble +// 2 nextFloat +// 2 nextByte +// 2 nextShort +// 2 nextChar +// 0 Value\s\(\) diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/safeCallWithElvis.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/safeCallWithElvis.kt new file mode 100644 index 00000000000..4c1af3bf4c7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/safeCallWithElvis.kt @@ -0,0 +1,9 @@ +class A(val x : Int, val y : A?) + +fun check(a : A?) : Int { + return a?.y?.x ?: (a?.x ?: 3) +} + +// 0 valueOf +// 0 Value\s\(\) +// 0 ACONST_NULL diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/severalInlines.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/severalInlines.kt new file mode 100644 index 00000000000..0c7f5a87ea7 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/severalInlines.kt @@ -0,0 +1,34 @@ + +inline fun foo(x : R, y : R, block : (R, R) -> T) : T { + return block(x, y) +} + +fun bar() { + foo(1, 2) { x, y -> x + y } + foo(1L, 2L) { x, y -> x + y } + foo(1f, 2f) { x, y -> x + y } + foo(1.toDouble(), 2.toDouble()) { x, y -> x + y } + foo(1.toByte(), 2.toByte()) { x, y -> x + y } + foo(1.toShort(), 2.toShort()) { x, y -> x + y } + foo('a', 'b') { x, y -> x == y } + foo(true, false) { x, y -> x || y } +} + +// 0 valueOf +// 0 Value\s\(\) +// 1 LOCALVARIABLE x I L6 L11 5 +// 1 LOCALVARIABLE y I L6 L11 4 +// 1 LOCALVARIABLE x J L19 L24 6 +// 1 LOCALVARIABLE y J L19 L24 4 +// 1 LOCALVARIABLE x F L32 L37 5 +// 1 LOCALVARIABLE y F L32 L37 4 +// 1 LOCALVARIABLE x D L45 L50 6 +// 1 LOCALVARIABLE y D L45 L50 4 +// 1 LOCALVARIABLE x B L58 L63 5 +// 1 LOCALVARIABLE y B L58 L63 4 +// 1 LOCALVARIABLE x S L71 L76 5 +// 1 LOCALVARIABLE y S L71 L76 4 +// 1 LOCALVARIABLE x C L84 L91 5 +// 1 LOCALVARIABLE y C L84 L91 4 +// 1 LOCALVARIABLE x Z L99 L106 5 +// 1 LOCALVARIABLE y Z L99 L106 4 diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/simple.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/simple.kt new file mode 100644 index 00000000000..949ce2fddaa --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/simple.kt @@ -0,0 +1,11 @@ + +inline fun foo(x : Int, block : (Int) -> Int) : Int { + return block(x) +} + +fun bar() { + foo(1) { x -> x + 1 } +} + +// 1 java/lang/Integer.valueOf +// 1 intValue diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt new file mode 100644 index 00000000000..a1bd06ba233 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt @@ -0,0 +1,28 @@ +fun returningBoxed() : Int? = 1 +fun acceptingBoxed(x : Int?) : Int ? = x + +class A(var x : Int? = null) + +fun foo() { + val rb = returningBoxed() + acceptingBoxed(2) + + val a = A() + a.x = 3 + + val b = Array(4, { null }) + b[100] = 5 + + val x = 6 : Int? + val hc = x!!.hashCode() + + val y = 7 : Int? + val z = 8 : Int? + val res = y.identityEquals(z) + + val c1: Any = if (1 == 1) 0 else "abc" + val c2: Any = if (1 != 1) 0 else "abc" +} + +// 10 java/lang/Integer.valueOf +// 1 intValue diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/variableClash.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/variableClash.kt new file mode 100644 index 00000000000..8c9ff018aa5 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/variableClash.kt @@ -0,0 +1,14 @@ + +fun bar() { + var x : Object? = java.lang.Integer.valueOf(1) as Object? + + val y1 : Int = (x as Int?)!! + + x = java.lang.Long.valueOf(1) as Object? + + val y2 : Long = (x as Long?)!! +} + +// 2 valueOf +// 1 intValue +// 1 longValue diff --git a/compiler/testData/codegen/bytecodeText/boxingOptimization/variables.kt b/compiler/testData/codegen/bytecodeText/boxingOptimization/variables.kt new file mode 100644 index 00000000000..5a77ee8dfe5 --- /dev/null +++ b/compiler/testData/codegen/bytecodeText/boxingOptimization/variables.kt @@ -0,0 +1,21 @@ + +inline fun foo(x : R, block : (R) -> T) : T { + var y = x + var z = y + z = x + return block(z) +} + +fun bar() { + foo(1) { x -> x } + foo(1f) { x -> x } + foo(1L) { x -> x } + foo(1.toDouble()) { x -> x } + foo(1.toShort()) { x -> x } + foo(1.toByte()) { x -> x } + foo('a') { x -> x } + foo(true) { x -> x } +} + +// 0 valueOf +// 0 Value\s\(\) diff --git a/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java index 0a4192ea02a..aaf811ab3a0 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/BytecodeTextTestGenerated.java @@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.AbstractBytecodeTextTest; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/codegen/bytecodeText") -@InnerTestClasses({BytecodeTextTestGenerated.Constants.class, BytecodeTextTestGenerated.DirectInvoke.class, BytecodeTextTestGenerated.Statements.class}) +@InnerTestClasses({BytecodeTextTestGenerated.BoxingOptimization.class, BytecodeTextTestGenerated.Constants.class, BytecodeTextTestGenerated.DirectInvoke.class, BytecodeTextTestGenerated.Statements.class}) public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { @TestMetadata("accessorForProtected.kt") public void testAccessorForProtected() throws Exception { @@ -152,6 +152,69 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { doTest("compiler/testData/codegen/bytecodeText/traitImplGeneratedOnce.kt"); } + @TestMetadata("compiler/testData/codegen/bytecodeText/boxingOptimization") + public static class BoxingOptimization extends AbstractBytecodeTextTest { + public void testAllFilesPresentInBoxingOptimization() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/bytecodeText/boxingOptimization"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("casts.kt") + public void testCasts() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/casts.kt"); + } + + @TestMetadata("checkcastAndInstanceOf.kt") + public void testCheckcastAndInstanceOf() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/checkcastAndInstanceOf.kt"); + } + + @TestMetadata("fold.kt") + public void testFold() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/fold.kt"); + } + + @TestMetadata("nullCheck.kt") + public void testNullCheck() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/nullCheck.kt"); + } + + @TestMetadata("progressions.kt") + public void testProgressions() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/progressions.kt"); + } + + @TestMetadata("safeCallWithElvis.kt") + public void testSafeCallWithElvis() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/safeCallWithElvis.kt"); + } + + @TestMetadata("severalInlines.kt") + public void testSeveralInlines() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/severalInlines.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/simple.kt"); + } + + @TestMetadata("unsafeRemoving.kt") + public void testUnsafeRemoving() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/unsafeRemoving.kt"); + } + + @TestMetadata("variableClash.kt") + public void testVariableClash() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/variableClash.kt"); + } + + @TestMetadata("variables.kt") + public void testVariables() throws Exception { + doTest("compiler/testData/codegen/bytecodeText/boxingOptimization/variables.kt"); + } + + } + @TestMetadata("compiler/testData/codegen/bytecodeText/constants") public static class Constants extends AbstractBytecodeTextTest { public void testAllFilesPresentInConstants() throws Exception { @@ -239,6 +302,7 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest { public static Test suite() { TestSuite suite = new TestSuite("BytecodeTextTestGenerated"); suite.addTestSuite(BytecodeTextTestGenerated.class); + suite.addTestSuite(BoxingOptimization.class); suite.addTestSuite(Constants.class); suite.addTestSuite(DirectInvoke.class); suite.addTestSuite(Statements.class); diff --git a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java index 3fef55ce8dd..405a486a423 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/codegen/generated/BlackBoxWithStdlibCodegenTestGenerated.java @@ -31,7 +31,7 @@ import org.jetbrains.jet.codegen.generated.AbstractBlackBoxCodegenTest; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/codegen/boxWithStdlib") -@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class}) +@InnerTestClasses({BlackBoxWithStdlibCodegenTestGenerated.Annotations.class, BlackBoxWithStdlibCodegenTestGenerated.Arrays.class, BlackBoxWithStdlibCodegenTestGenerated.BoxingOptimization.class, BlackBoxWithStdlibCodegenTestGenerated.CallableReference.class, BlackBoxWithStdlibCodegenTestGenerated.Casts.class, BlackBoxWithStdlibCodegenTestGenerated.DataClasses.class, BlackBoxWithStdlibCodegenTestGenerated.Evaluate.class, BlackBoxWithStdlibCodegenTestGenerated.FullJdk.class, BlackBoxWithStdlibCodegenTestGenerated.HashPMap.class, BlackBoxWithStdlibCodegenTestGenerated.JdkAnnotations.class, BlackBoxWithStdlibCodegenTestGenerated.PlatformNames.class, BlackBoxWithStdlibCodegenTestGenerated.Ranges.class, BlackBoxWithStdlibCodegenTestGenerated.Reflection.class, BlackBoxWithStdlibCodegenTestGenerated.Regressions.class, BlackBoxWithStdlibCodegenTestGenerated.Strings.class, BlackBoxWithStdlibCodegenTestGenerated.ToArray.class, BlackBoxWithStdlibCodegenTestGenerated.Vararg.class, BlackBoxWithStdlibCodegenTestGenerated.When.class}) public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInBoxWithStdlib() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib"), Pattern.compile("^(.+)\\.kt$"), true); @@ -98,6 +98,59 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode } + @TestMetadata("compiler/testData/codegen/boxWithStdlib/boxingOptimization") + public static class BoxingOptimization extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInBoxingOptimization() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/codegen/boxWithStdlib/boxingOptimization"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("casts.kt") + public void testCasts() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/casts.kt"); + } + + @TestMetadata("checkcastAndInstanceOf.kt") + public void testCheckcastAndInstanceOf() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/checkcastAndInstanceOf.kt"); + } + + @TestMetadata("fold.kt") + public void testFold() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/fold.kt"); + } + + @TestMetadata("nullCheck.kt") + public void testNullCheck() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/nullCheck.kt"); + } + + @TestMetadata("progressions.kt") + public void testProgressions() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/progressions.kt"); + } + + @TestMetadata("safeCallWithElvis.kt") + public void testSafeCallWithElvis() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/safeCallWithElvis.kt"); + } + + @TestMetadata("simple.kt") + public void testSimple() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/simple.kt"); + } + + @TestMetadata("unsafeRemoving.kt") + public void testUnsafeRemoving() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/unsafeRemoving.kt"); + } + + @TestMetadata("variables.kt") + public void testVariables() throws Exception { + doTestWithStdlib("compiler/testData/codegen/boxWithStdlib/boxingOptimization/variables.kt"); + } + + } + @TestMetadata("compiler/testData/codegen/boxWithStdlib/callableReference") @InnerTestClasses({CallableReference.Function.class, CallableReference.Property.class}) public static class CallableReference extends AbstractBlackBoxCodegenTest { @@ -1894,6 +1947,7 @@ public class BlackBoxWithStdlibCodegenTestGenerated extends AbstractBlackBoxCode suite.addTestSuite(BlackBoxWithStdlibCodegenTestGenerated.class); suite.addTestSuite(Annotations.class); suite.addTestSuite(Arrays.class); + suite.addTestSuite(BoxingOptimization.class); suite.addTest(CallableReference.innerSuite()); suite.addTestSuite(Casts.class); suite.addTest(DataClasses.innerSuite());