Reproduce assertion failure from unresolvable method reference

Bug: b/236875523
Change-Id: I04c5c84ebb448e4862570999a44d72e6241c70c6
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/UnresolvableMethodWithClassMergingTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/UnresolvableMethodWithClassMergingTest.java
new file mode 100644
index 0000000..4a027fc
--- /dev/null
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/UnresolvableMethodWithClassMergingTest.java
@@ -0,0 +1,62 @@
+// Copyright (c) 2022, 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.classmerging.horizontal;
+
+import com.android.tools.r8.CompilationFailedException;
+import com.android.tools.r8.TestParameters;
+import org.junit.Test;
+
+public class UnresolvableMethodWithClassMergingTest extends HorizontalClassMergingTestBase {
+
+  public UnresolvableMethodWithClassMergingTest(TestParameters parameters) {
+    super(parameters);
+  }
+
+  // TODO(christofferqa): Should not fail compilation.
+  @Test(expected = CompilationFailedException.class)
+  public void testR8() throws Exception {
+    testForR8(parameters.getBackend())
+        .addProgramClasses(Main.class, A.class, B.class)
+        .addKeepMainRule(Main.class)
+        .addDontWarn(Missing.class)
+        .addHorizontallyMergedClassesInspector(
+            inspector -> inspector.assertMergedInto(B.class, A.class).assertNoOtherClassesMerged())
+        .setMinApi(parameters.getApiLevel())
+        .compile()
+        .addRunClasspathFiles(buildOnDexRuntime(parameters, Missing.class))
+        .run(parameters.getRuntime(), Main.class)
+        .assertSuccessWithOutputLines("A", "B");
+  }
+
+  public static class Main {
+    public static void main(String[] args) {
+      System.out.println(new A());
+      Missing.print(new B());
+    }
+  }
+
+  static class A {
+
+    @Override
+    public String toString() {
+      return "A";
+    }
+  }
+
+  static class B {
+
+    @Override
+    public String toString() {
+      return "B";
+    }
+  }
+
+  static class Missing {
+
+    static void print(B b) {
+      System.out.println(b);
+    }
+  }
+}