Add test to optimize Kotlin lambdas after merging.
Bug: 123737770
Change-Id: I002b0cf9bafd22296991d47404ecf4cf116a190a
diff --git a/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingWithReprocessingTest.java b/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingWithReprocessingTest.java
new file mode 100644
index 0000000..31db483
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/kotlin/KotlinLambdaMergingWithReprocessingTest.java
@@ -0,0 +1,27 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package com.android.tools.r8.kotlin;
+
+import com.android.tools.r8.utils.InternalOptions;
+import java.util.function.Consumer;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class KotlinLambdaMergingWithReprocessingTest extends AbstractR8KotlinTestBase {
+ private Consumer<InternalOptions> optionsModifier =
+ o -> {
+ o.enableTreeShaking = true;
+ o.enableMinification = false;
+ o.enableInlining = true;
+ o.enableClassInlining = true;
+ o.enableLambdaMerging = true;
+ };
+
+ @Ignore("b/123737770")
+ @Test
+ public void testMergingKStyleLambdasAndReprocessing() throws Exception {
+ final String mainClassName = "reprocess_merged_lambdas_kstyle.MainKt";
+ runTest("reprocess_merged_lambdas_kstyle", mainClassName, optionsModifier, null);
+ }
+}
diff --git a/src/test/kotlinR8TestResources/reprocess_merged_lambdas_kstyle/main.kt b/src/test/kotlinR8TestResources/reprocess_merged_lambdas_kstyle/main.kt
new file mode 100644
index 0000000..a71b9af
--- /dev/null
+++ b/src/test/kotlinR8TestResources/reprocess_merged_lambdas_kstyle/main.kt
@@ -0,0 +1,15 @@
+// Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+package reprocess_merged_lambdas_kstyle
+
+private var COUNT = 11
+
+private fun next() = "${COUNT++}"
+
+fun consumeOne(l: (x: String) -> String): String = l(next())
+
+fun main(args: Array<String>) {
+ println(consumeOne { consumeOne { consumeOne { _ -> "A" } } })
+ println(consumeOne { consumeOne { consumeOne { _ -> "B" } } })
+}
\ No newline at end of file