Move assertion to where it actually must hold.

When merging stack we can have a basic type on one path and the null
marker on the other path. In that case we take the basic type and
it is *not* true that the values are compatible. Only if none of
the stack values are null can is it guaranteed that they are
compatible.

R=sgjesse@google.com, zerny@google.com

Change-Id: I7232ee278102a0624323f744b047e626b480a38f
diff --git a/src/main/java/com/android/tools/r8/ir/conversion/JarState.java b/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
index 9e59c48..51a8117 100644
--- a/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
+++ b/src/main/java/com/android/tools/r8/ir/conversion/JarState.java
@@ -412,7 +412,6 @@
     assert currentStack.size() == newStack.size();
     List<Slot> mergedStack = null;
     for (int i = 0; i < currentStack.size(); i++) {
-      assert currentStack.get(i).isCompatibleWith(newStack.get(i).type);
       if (currentStack.get(i).type == JarState.NULL_TYPE &&
           newStack.get(i).type != JarState.NULL_TYPE) {
         if (mergedStack == null) {
@@ -421,6 +420,7 @@
         }
         mergedStack.add(newStack.get(i));
       } else if (mergedStack != null) {
+        assert currentStack.get(i).isCompatibleWith(newStack.get(i).type);
         mergedStack.add(currentStack.get(i));
       }
     }