Merge "Modernize field rebinding and resolution tests."
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/java/com/android/tools/r8/naming/b123068484/FieldRenamingTest.java b/src/test/java/com/android/tools/r8/naming/b123068484/FieldRenamingTest.java
index 119cb98..6908fda 100644
--- a/src/test/java/com/android/tools/r8/naming/b123068484/FieldRenamingTest.java
+++ b/src/test/java/com/android/tools/r8/naming/b123068484/FieldRenamingTest.java
@@ -4,6 +4,7 @@
package com.android.tools.r8.naming.b123068484;
import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThat;
@@ -14,6 +15,7 @@
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.ClassSubject;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
+import com.android.tools.r8.utils.codeinspector.FieldSubject;
import com.android.tools.r8.utils.codeinspector.InstructionSubject;
import com.android.tools.r8.utils.codeinspector.MethodSubject;
import java.nio.file.Path;
@@ -74,6 +76,9 @@
}
private void inspect(CodeInspector inspector) {
+ FieldSubject fld = inspector.clazz(CONCRETE1.getTypeName().replace("Concrete1", "Abs"))
+ .uniqueFieldWithName("strField");
+
ClassSubject main = inspector.clazz(MAIN);
assertThat(main, isPresent());
MethodSubject methodSubject = main.mainMethod();
@@ -83,7 +88,9 @@
.iterateInstructions(InstructionSubject::isInstanceGet)
.forEachRemaining(instructionSubject -> {
String fieldName = instructionSubject.getField().name.toString();
+ // All of those field references will be renamed.
assertNotEquals("strField", fieldName);
+ assertEquals(fld.getFinalName(), fieldName);
});
}
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