Fix for issue #615: internal compiler error when conditional result type is null.
Reviewed by mmendez.

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@292 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeMap.java b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeMap.java
index f5d2607..ac61804 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/TypeMap.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/TypeMap.java
@@ -78,25 +78,38 @@
       return cached;
     } else if (binding instanceof BaseTypeBinding) {
       BaseTypeBinding baseTypeBinding = (BaseTypeBinding) binding;
+      // see org.eclipse.jdt.internal.compiler.lookup.TypeIds constants
       switch (baseTypeBinding.id) {
-        case BaseTypeBinding.T_void:
-          return program.getTypeVoid();
-        case BaseTypeBinding.T_boolean:
-          return program.getTypePrimitiveBoolean();
+        case BaseTypeBinding.T_undefined:
+          return null;
+        case BaseTypeBinding.T_JavaLangObject:
+          // here for consistency, should already be cached
+          return program.getTypeJavaLangObject();
         case BaseTypeBinding.T_char:
           return program.getTypePrimitiveChar();
         case BaseTypeBinding.T_byte:
           return program.getTypePrimitiveByte();
         case BaseTypeBinding.T_short:
           return program.getTypePrimitiveShort();
-        case BaseTypeBinding.T_int:
-          return program.getTypePrimitiveInt();
+        case BaseTypeBinding.T_boolean:
+          return program.getTypePrimitiveBoolean();
+        case BaseTypeBinding.T_void:
+          return program.getTypeVoid();
         case BaseTypeBinding.T_long:
           return program.getTypePrimitiveLong();
-        case BaseTypeBinding.T_float:
-          return program.getTypePrimitiveFloat();
         case BaseTypeBinding.T_double:
           return program.getTypePrimitiveDouble();
+        case BaseTypeBinding.T_float:
+          return program.getTypePrimitiveFloat();
+        case BaseTypeBinding.T_int:
+          return program.getTypePrimitiveInt();
+        case BaseTypeBinding.T_JavaLangString:
+          // here for consistency, should already be cached
+          return program.getTypeJavaLangString();
+        case BaseTypeBinding.T_null:
+          return program.getTypeNull();
+        default:
+          return null;
       }
     } else if (binding instanceof ArrayBinding) {
       ArrayBinding arrayBinding = (ArrayBinding) binding;
@@ -110,8 +123,9 @@
           arrayBinding.dimensions);
 
       return arrayType;
+    } else {
+      return null;
     }
-    return null;
   }
 
 }
diff --git a/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java b/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java
index 91829e4..d4659e4 100644
--- a/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java
+++ b/user/test/com/google/gwt/dev/jjs/test/CompilerTest.java
@@ -86,9 +86,9 @@
     oaa[0] = new Object[4];
     oaa[0][0] = "bar";
     assertEquals(oaa[0][0], "bar");
-    
+
     Apple[] apple = cannotOptimize() ? new Granny[3] : new Apple[3];
-    Apple g = cannotOptimize() ? (Apple)new Granny() : (Apple)new Fuji();
+    Apple g = cannotOptimize() ? (Apple) new Granny() : (Apple) new Fuji();
     Apple a = apple[0] = g;
     assertEquals(g, a);
   }
@@ -289,6 +289,14 @@
     }
   }
 
+  /**
+   * Issue #615: Internal Compiler Error
+   */
+  public void testImplicitNull() {
+    boolean b;
+    String test = ((((b = true) ? null : null) + " ") + b);
+  }
+
   public void testLabels() {
     int i = 0, j = 0;
     outer : for (i = 0; i < 1; ++i) {
@@ -410,7 +418,7 @@
 
   public void testNullFlowVsClassCastPrecedence() {
     try {
-      ((UninstantiableType)new Object()).returnNull();
+      ((UninstantiableType) new Object()).returnNull();
       fail();
     } catch (ClassCastException e) {
       // success
@@ -428,11 +436,11 @@
         break;
     }
   }
-  
+
   public void testSubclassStaticInnerAndClinitOrdering() {
     new CheckSubclassStaticInnerAndClinitOrdering();
   }
-  
+
   public void testReturnStatementInCtor() {
     class Foo {
       Foo(int i) {